/*************************************************/ // paint1Error.cpp // R. A. Hillyard // Last Modified: 02/01/2001 // // Determine the number of gallons of paint needed for a given area. // The user will enter the length and height in feet and inches // // modified to illustrate syntax, semantic, and run time errors /*************************************************/ #include <iostream>
using namespace std;
const float sqFtPerGal = 350.0; int main( void ) { float feet; floa inches; float length; float height; float area; float numGallons cout << "Enter the length in feet and inches " << endl; cout << "# of feet: "; cin >> feet; cout << "# of inches: "; cin >> inches; length = feet + inches/12.0; cout << endl << "Enter the height in feet and inches " << endl; cout << "# of feet: "; cin >> feet; cout << "# of inches: "; cin >> inches; height = feet + inches/0.0; area = length * length; numGallons = area/sqFtPerGal; cout << "\nYou will need: " << numGallons << " gallons of paint to cover"; cout << "\nthe area of " << area << " square feet" << endl; return 0; }