Chapter 02: Using Data in C#
Chapter 02: Using Data in C#
Using Data
1
Objectives
2
Objectives
3
Objectives
4
Declaring Variables
5
Declaring Variables
6
Declaring Variables
7
Declaring Variables
8
Declaring Variables
9
Displaying Variable Values
10
Displaying Variable Values
12
Displaying Variable Values
13
Displaying Variable Values
15
Displaying Variable Values
• Unaligned output
17
Using the Integral Data Types
18
Using the Standard Binary Arithmetic
Operators
• The five most commonly used binary arithmetic
operators
19
Using the Standard Binary Arithmetic
Operators
• When you divide two integers (using the division
operator or the modulus operator), the result is
ALWAYS an integer
• Operator precedence refers to the order in
which parts of a mathematical expression are
evaluated
20
Using Shortcut Arithmetic Operators
21
Using the Boolean Data Type
22
Using Floating-Point Data Types
23
Formatting Floating-Point Values
24
Formatting Floating-Point Values
• Format Specifiers
25
Understanding Numeric Type Conversion
26
Understanding Numeric Type Conversion
27
Using the char Data Type
28
Using the char Data Type
29
Using the string Data Type
30
Using the string Data Type
35
Defining Named Constants
• SalesTax program
36
Defining Named Constants
37
Accepting Console Input
38
Accepting Console Input
• InteractiveSalesTax program
39
Accepting Console Input
40
Accepting Console Input
42
Chapter Summary
43
Chapter Summary
44