signing it the value of an expression. At execution time, the expression is evaluated and the result is stored into the variable. Another way to change the value of a variable is to add 1 to its value with the increment operator (++) or to subtract 1 from its value with the decrement operator (--).
Program output is accomplished by means of the output stream variable cout, along with the insertion operator (<). Each insertion operation sends output data to the standard output device. When an endl manipulator appears instead of a data item, the computer terminates the current output line and goes on to the next line.
A C++ program is a collection of one or more function definitions (and optionally some declarations outside of any function). One of the functions must be named main. Execution of a program always begins with the main function. Collectively, the functions all cooperate to produce the desired results.
Quick Check
1. Every C++ program consists of at least how many functions? (p. 45)
2. Use the following syntax template to decide whether your last name is a valid C++ identifier.(pp. 4850)
3. Write a C++ constant declaration that gives the name DELTA to the value 0.562. (pp. 6061)
4. Which of the following words are reserved words in C++? (Hint: Look in Appendix A.)
const pi float integer sqrt
(p. 50)
5. Declare an int variable named count, a float variable named sum, and a char variable named letter. (pp. 5759)
6. Assign the value 10 to the int variable toes. (pp. 6364)
7. You want to divide 9 by 5.
a. How do you write the expression if you want the result to be the floating point value 1.8?
b. How do you write it if you want only the integer quotient? (pp. 6466)
8. What is the value of the following C++ expression?