home *** CD-ROM | disk | FTP | other *** search
/ C by Discovery (4th Edition) / C_By_Discovery_4th_Edition.tar / C_By_Discovery_4th_Edition / _DISK_ / ch12 / area.cpp next >
C/C++ Source or Header  |  2005-06-16  |  928b  |  29 lines

  1. //             area.cpp
  2. //
  3. // Synopsis  - Prompts for and accepts input of the height and 
  4. //             width of a rectangle, and displays the area of the 
  5. //             rectangle.
  6. //
  7. // Objective - To study the input stream cin, the extraction 
  8. //             operator, >>, and discover more about output in 
  9. //             C++.
  10.  
  11. // Include Files
  12. #include <iostream.h>
  13.  
  14. int main()
  15. {
  16.     int width, height;                                   // Note 1
  17.     cout << "Area of a Rectangle\n"                      // Note 2
  18.          << "-------------------\n\n";
  19.  
  20.     cout << "Enter the height: ";
  21.     cin  >> height;                                      // Note 3
  22.  
  23.     cout << "Enter the width: ";
  24.     cin  >> width;                                       // Note 3
  25.                                                          // Note 4
  26.     cout << "The area is " << height * width << "\n";
  27.     return 0;
  28. }
  29.