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 >
Wrap
C/C++ Source or Header
|
2005-06-16
|
928b
|
29 lines
// area.cpp
//
// Synopsis - Prompts for and accepts input of the height and
// width of a rectangle, and displays the area of the
// rectangle.
//
// Objective - To study the input stream cin, the extraction
// operator, >>, and discover more about output in
// C++.
// Include Files
#include <iostream.h>
int main()
{
int width, height; // Note 1
cout << "Area of a Rectangle\n" // Note 2
<< "-------------------\n\n";
cout << "Enter the height: ";
cin >> height; // Note 3
cout << "Enter the width: ";
cin >> width; // Note 3
// Note 4
cout << "The area is " << height * width << "\n";
return 0;
}