Professional Documents
Culture Documents
Chapter Two: Using Data
Chapter Two: Using Data
Chapter Two: Using Data
Using Data
1
Declaring Variables
5
Declaring Variables
6
Declaring Variables
7
Declaring Variables
8
Displaying Variable Values
9
Displaying Variable Values
11
Displaying Variable Values
12
Displaying Variable Values
14
Displaying Variable Values
• Unaligned output
16
Using the Integral Data Types
17
Using the Standard Binary Arithmetic
Operators
• The five most commonly used binary arithmetic
operators
18
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
19
Using Shortcut Arithmetic Operators
20
Using the Boolean Data Type
21
Using Floating-Point Data Types
22
Formatting Floating-Point Values
23
Formatting Floating-Point Values
• Format Specifiers
24
Understanding Numeric Type Conversion
25
Understanding Numeric Type Conversion
26
Using the char Data Type
27
Using the char Data Type
28
Using the string Data Type
29
Using the string Data Type
34
Defining Named Constants
• SalesTax program
35
Defining Named Constants
36
Accepting Console Input
37
Accepting Console Input
• InteractiveSalesTax program
38
Accepting Console Input
39
Accepting Console Input
41
Chapter Summary
42
Chapter Summary
43