Good day guys:
The assignment is :
Write a program that will generate an unknown (between 93 & 139) count of random numbers whose values fall between 147 and 206. Calculate the average to 2 decimal places and the standard deviation (3 decimal places). On the monitor, display only the count of numbers, the average and the standard deviation. On the printer, display the same information after you have listed all the numbers in 5 columns in order from high to low and then skipped two spaces.
So far, this is what I've got. Thank you and have agood day. Any assistance is sincerely appreciated...
#include <cstring>
#include <iostream>
#include <iomanip>
#include <cmath>
#include <fstream>
#include <string>
#include <ctime>
using namespace std;
int main()
{
srand ( static_cast<unsigned int> ( time ( 0 ) ) );
int i;
int Low = 147;
int High = 206;
double numbers;//the actual numnbers
double avg;//average of group of numbers
double sdeva;// calcualtion parts of standard deviation
double sdevb;//actual square root for standard deviation
float count;//amout of numbers
int sum;//sum of the numbers
for (i=0; i<93 && i>139; i++)
{
numbers = rand()%(High-Low+1)+Low;
cout<<numbers<<endl;
}
{
if (i%5 ==0)
cout<<endl;
cout<<setw(10)<<numbers;
}
avg = numbers/count;
cout<<avg<<endl;
sdeva = ((sum * sum)/count) - ((sum * sum)/count);
sdevb = sqrt(sdeva);
cout<<sdevb;
return 0;
}
1. It's saying that 'numbers' is undeclared. I dont know why..isn't it declared ok?
2. How do I calcualte the sum, since it's going to change every time i run the program?
3. The way that I have the 'sqrt' function to calcualte the standard deviation...is it ok?
Thanks much. Please also take a look at my previous post...