October 9, 200421 yr Well I'm starting to understand this stuff. I've completed my homework except for 1 thing, WOOT!Assignment is to write a program where I input sales amounts until I enter -1I have everything correct except the calculations to figure out the low sales amount.Can you tell me what I'm doing wrong.#include <iostream>#include <iomanip>#include <cmath>using namespace std;int main () {int sales;double highSalesAmount = 0,lowSalesAmount = 0,averageSalesAmount = 0,numberOfSales = 0,totalSales = 0;// setup floating point format for output of dollarscout.setf (ios::fixed, ios::floatfield);cout << setprecision (2);// display headings and column heading linescout << "Acme Sales Report Program\n"<< "Enter the next sales or -1 to quit: ";cin >> sales;// main loop - process all input lines in the filewhile (sales >= 0){numberOfSales++;totalSales += sales;averageSalesAmount = totalSales / numberOfSales;if (sales > highSalesAmount){ highSalesAmount = sales;}if (sales < highSalesAmount){lowSalesAmount = sales;}cout << "Enter the next sales or -1 to quit: ";cin >> sales;if (sales < 0 ){cout << "Acme Sales Summary\n"<< "The high sales for today was : " << highSalesAmount << endl<< "The low sales for today was : " << lowSalesAmount << endl<< "The average sales for today was : " << averageSalesAmount << endl;}}return 0;}Thanks again,Dom
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.