Sams Teach Yourself C++ in 21 Days
5: smallNumber = 32767; 6: std::cout << “small number:” << smallNumber << std::endl; 7: smallNumber++; 8: std: ...
Working with Variables and Constants 57 3 Characters and Numbers ............................................................... ...
LISTING3.7 Printing Characters Based on Numbers, Take 2 1: #include <iostream> 2: int main() 2: { 4: for (unsigned char i ...
Working with Variables and Constants 59 3 \” Double quote \? Question mark \\ Backslash \000 Octal notation \xhhh Hexadecimal no ...
If you later decided to change the number of students in each class, you could do so where you define the constant studentsPerCl ...
Working with Variables and Constants 61 3 Enumerated Constants ................................................................. ...
It is important to realize that enumerator variables are generally of type unsigned int, and that the enumerated constants equat ...
Working with Variables and Constants 63 3 6: const int Tuesday = 2; 7: const int Wednesday = 3; 8: const int Thursday = 4; 9: co ...
Today’s lesson also presented literal and symbolic constants as well as enumerated con- stants. You learned two ways to declare ...
Working with Variables and Constants 65 3 variable is then interpreted as an unsignednumber. Thus, –1, whose bit pattern is 1111 ...
Exercises .......................................................................................................... What would ...
DAY 4 WEEK 1 Creating Expressions and Statements At its heart, a program is a set of commands executed in sequence. The power in ...
Starting with Statements ........................................................................................ In C++, a stat ...
Creating Expressions and Statements 69 4 Although every statement in the block must end with a semicolon, the block itself does ...
This line is evaluated in the following order: Add a to b. Assign the result of the expression a + b to x. Assign the result of ...
Creating Expressions and Statements 71 4 Assignment operators Mathematical operators Assignment Operators .................... ...
result = 56 + 32 // result = 88 result = 12 – 10 // result = 2 result = 21 / 7 // result = 3 result = 12 * 4 // result = 48 Subt ...
Creating Expressions and Statements 73 4 Integer Division and Modulus Integer division is the division you learned when you were ...
The first two lines create the myAgevariable and a temporary variable. As you can see in the third line, the value in myAgehas t ...
Creating Expressions and Statements 75 4 As you might have guessed, C++ got its name by applying the increment operator to the n ...
«
1
2
3
4
5
6
7
8
9
10
»
Free download pdf