My program seems all correct but when I run the program my outputs are all what they need to be but I just cant seem to figure out how to send my output into 5 seperate columns. After reading the teachers notes I am more confused with his explanation on how to output to columns.
Here is the Directions:
Write a program that will generate an unknown (between 93 and 139) count of random numbers whose values fall between 147 and 206. Calculate the average to 2 decimal places and standard deviation to 3 decimals. On the monitor display only the count of numbers, the mean, and the standard deviation. Then after you have displayed alll of that information list them again in 5 columns in order from high to low and then have skipped two spaces.
Here is what I have so far:
srand((unsigned int) time (NULL));
int first, second;
int high, low, high2, low2;
int number, number2;
int total = 0, total2 = 0, overall = 0;
double average, deviation;
high = 139;
low = 93;
high2 = 206;
low2 = 147;
for (first=0; first<1; first++)
{
number = rand()%(high-low+1)+low;
}
for (second=0; second < number; second++)
{
number2 = rand()%(high2-low2+1)+low2;
total = number2 * number2;
total2 = total2 + number2;
overall = overall + total;
cout << number2 << endl;
}
average = ((double)total2 / (double)second);
deviation=sqrt(((double)overall/(double)second)-(((double)total2*(double)total2)/((double)second*(double)second)));
cout << fixed << showpoint << endl;
cout << second << endl;
cout << setprecision ( 2 ) << average << endl;
cout << setprecision ( 3 ) << deviation << endl;
Any assisntance you can give me on seperating my outputs into 5 seperate columns would be greatly appreciated.