{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

# C++HW1 - cout<<"\n\n" cout<< setw...

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

//Assignment #1 //Calculate Cost of Fountain Garden #include <iostream> #include <iomanip> using namespace std; int main () { cout << "Enter the width of the lawn:" ; double width; cin >> width; cout << "Enter the length of the lawn:" ; double length; cin >> length; double total = length * width; double half = (width / 2) * (length / 2); double lawn = (total - half) * 5; double halfwidth = width / 2; double halflength = length / 2; double gravel = half * 8; double fountain = 400; double cost = lawn + gravel + fountain; cout << fixed << setprecision ( 2 );
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: cout << " \n\n" ; cout << setw( 25 ) << "Lawn Dimensions" << setw( 8 ) << width << setw ( 8 ) << length << setw ( 10 ) << lawn << endl; cout << setw( 25 ) << "Gravel Dimensions" << setw( 8 )<< setw( 8 )<< halfwidth << setw( 8 )<< halflength << setw( 10 )<< gravel << endl; cout << setw( 25 ) << "Fountain" << setw( 26 )<< fountain << endl; cout << setw( 51 ) << "-----" << endl; cout << setw( 25 ) << "Total" << setw( 26 )<< cost << endl; return 0; }...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online