{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

readdata - c int main int length = 20.75 measured in inches...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
// file: readdata.cpp // author; N. Dale // adapted by: j. dzuback // modifed by: /* ***************************************** The program provides a test bed for a variety of cin statements in combination with different data inputs supplied by the user. The program calculates the cost of a sheet of glass based on the dimensions (length and width) and price per square foot. All values to be entered by the user. ***************************************** */ #include <iostream> #include <iomanip> using namespace std; u const int IN_PER_FTSQ = 144;
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: c int main () { int length = 20.75; // measured in inches int width = 32; // measured in inches float price = 46; // sold by square foot float cost; cout << fixed << showpoint; /* TO BE FILLED IN. */ cout << "Width: " << setw(5) << width << " Length: " << setw(5) << length << " Price: " << setw(6) << setprecision(2) << price << endl; cin >> width >> length >> price; cost = ((width * length) / IN_PER_FTSQ) * price; cout << "The cost of the glass is $" << setw(6) << cost << endl; return 0; }...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online