Module 1. Introduction to C and C++ Exercises

1.  Indicate True or False for the following statements concerning
C++'s relationship to the C language.

_____ (a) C++ is approximately a superset of C.
_____ (b) Most of the constructs of C are included in C++.
_____ (c) C++ adds extensions to C that improve the language's syntax,
make it easier to use, and that support object-oriented programming.
_____ (d) There are constructs supported by C that are not supported by C++.
_____ (e) There are constructs that are present in both C and C++ that
have different meanings in the two languages.

2.  In the following C++ program segment, change the C-style comments
to C++-style comments:

   /* Compute and echo
      volume of aquarium */
      fish_number = volume / 256; /*Each fish needs 256 cubic inches of water*/

3.  Write the #include statement for the standard C++ #include file
for input/output.

4.  Write three C++ output statements using cout, <<, and endl: (a)
one that outputs the variable width, (b) another that outputs the
string "length is " and the variable length, and (c) another that
outputs the three variables alpha, beta, and gamma.

5.  Write two C++ input statements using cin and >>: (a) one that
inputs the variable width, (b) another that inputs the three variables
length, width, and height.