Computer Science, asked by tahirabatool435, 8 months ago

A particular brand of paint covers 340 square feet per gallon . Write a program in C++ to determine and report approximately how many gallons of paint will be needed to paint two coats on a wooden fence that is 6 feet high and 100 feet long .

Answers

Answered by Anonymous
4

Answer:

#include <iostream>

using namespace std;

// named constant to give mnemonic name to "magic number"

const float SqFtPerGal = 350.0f;

// the function main() is always the entry point of the application

int main()

{

float length, width, area, paint; // to hold user values and results

// prompt user for length and width of wall

cout << "Enter length of wall : " << flush;

cin >> length;

cout << "Enter width of wall : " << flush;

cin >> width;

// calculate area and amount of paint needed

area = length * width;

paint = area / SqFtPerGal;

// output results with reasonable text

cout << "You need " << paint << " gallons of paint to cover "

<< area << " square feet of wall." << endl;

// program stops executing when it returns from main(), 0 means O.K.

return 0;

}

Similar questions