Submitted by: Submitted by brandnames888
Views: 397
Words: 1159
Pages: 5
Category: Other Topics
Date Submitted: 04/11/2011 04:54 AM
2
Data Types and Expressions
C# Programming: From Problem Analysis to Program Design
3rd Edition
C# Programming: From Problem Analysis to Program Design
1
Chapter 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
2
Chapter Objectives (continued)
• Use floating-point types
• Learn about the decimal data type
• Declare Boolean variables
• Declare and manipulate strings • Work with constants
C# Programming: From Problem Analysis to Program Design
3
Chapter 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
4
Data Representation
• Bits
– Bit – "Binary digIT" – 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
C# Programming: From Problem Analysis to Program Design
5
Binary Number System
Figure 2-1 Base–10 positional notation of 1326
C# Programming: From Problem Analysis to Program Design 6
Binary Number System (continued)
Figure 2-2 Decimal equivalent of 01101001
C# Programming: From Problem Analysis to Program Design 7
Data Representation (continued)
C# Programming: From Problem Analysis to Program Design
8
Data Representation (continued)
• Character sets
– With only 8 bits, can represent 28, or 256, different decimal values ranging from 0 to 255; this is 256 different characters
• Unicode – Character set used by C#...