Please help, running out of time. Assignment is attached. What I have so far is below. Where I am stuck is the "Range" ordeal. Please help:
Code:
#include <iostream>
using namespace std;
//Write a program that reads a series of numbers (doubles) from the user, then prints the mean and the
//range.
//Notes:
//• 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.
int main()
{
double n, count=0, sum=0;
for (;;)
{
if( cin.eof( ) ) break;
while (cin >> n)
if (n <0 || n >100){
cout << "out of range; ignored." << endl;
}
else {
++count;
sum += n;
}
}
cout << "The average is " << float (sum)/count << endl;
}