Chapter 2 Exercise Set 0: Chapter Review

  1. In the Values section, you were introduced to a few of C++’s data types. It will be very important to become familiar with C++’s fundamental data types to be able to program effectively with it.

    Read the Fundamental data types section in Variables and types from the cplusplus.com website, and Fundamental types from the C++ reference. Take notes from your reading, making your own table of the fundamental C++ data types.

  2. In the Outputting variables section, the body of the main function is given to you without the other lines needed for the program to compile and run. Include these lines of code in a complete program in a file named outputing_variables.cpp, then compile and run it and verify the result. Don’t forget to add the return statement at the end of the main function.

  3. Write a program in a file named ten_mathematical_expressions.cpp that displays ten mathematical expressions along with their evaluations in a form like:

    int n = 5;
    int m = 7;
    cout << "The product of " << n << " and " << m << " is ";
    cout << n * m << "." << endl;
    

    which when compiled and run will display:

    The product of 5 and 7 is 35.