/*************************************************/ // paint1a.cpp // R. A. Hillyard // Last Modified: 02/05/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 // // Modifyed to show use of cout statements /*************************************************/ #include <iostream>
using namespace std;
const float sqFtPerGal = 350.0; int main() { float feet, inches, length, height, area, numGallons; cout << "Enter the length in feet and inches: "; cin >> feet >> inches; length = feet + inches/12.0; cout << "\nEnter the height in feet and inches: "; cin >> feet >> inches; height = feet + inches/12.0; area = length * height; numGallons = area/sqFtPerGal; cout << "\nYou will need: " << numGallons << " gallons of paint to"; cout << "\ncover the area of " << area << " square feet\n\n";
cout << 2 << "nd time !!!"; cout << "\nYou will need: " << area/sqFtPerGal << " gallons of paint to\n"; cout << "cover the area of " << length * height << " square feet\n"; return 0; }
/****************program output****************/
Enter the length in feet and inches: 55.6 8 Enter the height in feet and inches: 44 9.5 You will need: 7.20079 gallons of paint to cover the area of 2520.28 square feet 2nd time !!! You will need: 7.20079 gallons of paint to cover the area of 2520.28 square feet