Lecture _3_2018_Sem1.pptx

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

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

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

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

View Full Document
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
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

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

View Full Document
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
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

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

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

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

View Full Document
C# Programming: From Problem Analysis to Program Design 8 Data Representation ( continued ) Table 2-1 Binary equivalent of selected decimal values
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

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

View Full Document
C# Programming: From Problem Analysis to Program Design 10 Data Representation ( continued ) Table 2-2 Common abbreviations for data representations
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

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

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

{[ snackBarMessage ]}

### What students are saying

• 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.

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

• 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.

Dana University of Pennsylvania ‘17, Course Hero Intern

• 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.

Jill Tulane University ‘16, Course Hero Intern