Lecture _3_2018_Sem1.pptx

Lecture _3_2018_Sem1.pptx - 2 Lecture 3(Week 3 Data Types...

Info icon This preview shows pages 1–13. Sign up to view the full content.

View Full Document Right Arrow Icon
C# Programming: From Problem Analysis to Program Design 1 Lecture 3 (Week 3) Data Types and Expressions 2 C# Programming: From Problem Analysis to Program Design 4th Edition
Image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
C# Programming: From Problem Analysis to Program Design 2 Lecture Objectives Examine how computers represent data Declare memory locations for data Explore the relationship between classes, objects, and types Use predefined data types Use integral data types
Image of page 2
C# Programming: From Problem Analysis to Program Design 3 Lecture Objectives ( continued ) Use floating-point types Learn about the decimal data type Declare Boolean variables Declare and manipulate strings Work with constants
Image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
C# Programming: From Problem Analysis to Program Design 4 Lecture Objectives ( continued ) Write assignment statements using arithmetic operators Learn about the order of operations Learn special formatting rules for currency Work through a programming example that illustrates the chapter’s concepts
Image of page 4
C# Programming: From Problem Analysis to Program Design 5 Data Representation Bits Bit – " B inary dig IT " Binary digit can hold 0 or 1 1 and 0 correspond to on and off, respectively Bytes Combination of 8 bits Represent one character, such as the letter A To represent data, computers use the base-2 number system , or binary number system
Image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
C# Programming: From Problem Analysis to Program Design 6 Binary Number System Figure 2-1 Base-10 positional notation of 1326
Image of page 6
C# Programming: From Problem Analysis to Program Design 7 Binary Number System (continued) Figure 2-2 Decimal equivalent of 01101001
Image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
C# Programming: From Problem Analysis to Program Design 8 Data Representation ( continued ) Table 2-1 Binary equivalent of selected decimal values
Image of page 8
C# Programming: From Problem Analysis to Program Design 9 Data Representation ( continued ) Character sets With only 8 bits, we can represent 2 8 , or 256, different decimal values ranging from 0 to 255; this is 256 different characters Unicode – character set used by C# (pronounced C Sharp) Uses 16 bits to represent characters 2 16 , or 65,536 unique characters, can be represented American Standard Code for Information Interchange (ASCII) – subset of Unicode First 128 characters are the same
Image of page 9

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
C# Programming: From Problem Analysis to Program Design 10 Data Representation ( continued ) Table 2-2 Common abbreviations for data representations
Image of page 10
C# Programming: From Problem Analysis to Program Design 11 Memory Locations for Data Identifier Names of elements that appear in a program Rules for creating an identifier Combination of alphabetic characters (a-z and A-Z), numeric digits (0-9), and the underscore First character in the name may not be numeric No embedded spaces – concatenate (append) words together by capitalizing the beginning letter of each word after the first; e.g. StudentName Keywords cannot be used Use the case of the character to your advantage Be descriptive with meaningful names
Image of page 11

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
C# Programming: From Problem Analysis to Program Design 12 Reserved Words in C# Table 2-3 C# keywords/ reserved words
Image of page 12
Image of page 13
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern