Hey guys I needed some help on this problem that we have to do for our introductory computer science class
PROBLEM:
Write a program that reads a series of numbers (doubles) from the user, then prints the mean and the
range.
• You do not know ahead of time how many numbers will be in the list.
• When you want to stop entering numbers, enter control‐Z.
• The range is the difference between the lowest and the highest number.
• The numbers will be in the range of 0.0 to 100.0. Ignore any numbers outside of this range.
My solution so far... it sucks but I have no idea what I am doing:
#include <iostream>
#include <string>
using namespace std;
int main ()
{
string answer = "";
double counter = 1.11;
int c;
while ((counter >= 0) && (counter <= 100))
{
cout << counter;
cin >> answer;
if (answer == "^Z")
break;
counter++;
}
if ((answer < 0) || (answer > 100)
cout << "out of range; ignored." << endl;
cout << "" << endl;
}
PLEASE HELP!