This chapter is from the book
Chapter Review
You can find the answers to the chapter review at the end of each chapter in Appendix J, “Answers to Chapter Review.”
- What are the modules of C++ programs called?
What does the following preprocessor directive do?
#include <iostream>
What does the following statement do?
using namespace std;
- What statement would you use to print the phrase “Hello, world” and then start a new line?
- What statement would you use to create an integer variable with the name cheeses?
- What statement would you use to assign the value 32 to the variable cheeses?
- What statement would you use to read a value from keyboard input into the variable cheeses?
- What statement would you use to print “We have X varieties of cheese,” where the current value of the cheeses variable replaces X?
What do the following function prototypes tell you about the functions?
int froop(double t); void rattle(int n); int prune(void);
- When do you not have to use the keyword return when you define a function?
Suppose your main() function has the following line:
cout << "Please enter your PIN: ";
And suppose the compiler complains that cout is an unknown identifier. What is the likely cause of this complaint, and what are three ways to fix the problem?