Skip to content
View in the app

A better way to browse. Learn more.

The Armory

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

small C++ question

Featured Replies

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.

Guest
Reply to this topic...

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.