I need help with an assignment for school. This is the problem:
You are tracking the prices of some asset over time. The user will input a series of floating-point prices (e.g. 16.105 for sixteen dollars, ten and a half cents). When the user enters the price 0 (zero), output the overall minimum, mean, and maximum prices. Hint: there could be thousands or millions of prices to process, so do not try to store each one as it arrives, but keep a running total..
I've been using a while loop for user input, but I don't know how to get the last 0 that marks the end of the list to not be included in calculating the average. Can anyone shine some light on this for me?
cin >> a;
if (a <= 100)
cout << "You picked a number less than 100" << endl;
if (a >= 100)
cout << "You picked a number greater than 100" << endl;
So you could use an if statement for when your variable is 0.