Electrical and Computer Engineering
26 of 52
UAH
CPE 112
Good Style
Example Continued
•int main()
•{
•    float grossFootage;         // Total square footage
•    float livingFootage;        // Living area
•    float costPerFoot;          // Cost/foot of living area
•
•    cout << fixed << showpoint;  // Set up floating pt.
•                                 //   output format
•
•    grossFootage = LENGTH * WIDTH * STORIES;
•    livingFootage = grossFootage - NON_LIVING_SPACE;
•    costPerFoot = PRICE / livingFootage;
•
•    cout << "Cost per square foot is "
•         << setw(6) << setprecision(2) << costPerFoot << endl;
•    return 0;
•}
•