Arrays with Random Numbers

Write a program in which you create an array with 250 elements. Populate the array with random real numbers between 1 and 100. Using the statistics library, calculate and output the following values: maximum, minimum, mean, standard deviation, and variance. Next, sort the array and output the median value.

I'm basically new to C++ and taking this 6 week course is killing me, I would greatly appreciate all of your help. This is what I have so far:

#include <iostream>
#include <cstdlib>
#include <time.h>

using namespace std;

int main ()
{
int A[250],i;
for (i=0;i<250;i++)
{
A[i]= (rand()%100)+1;
cout<<A[i]<<endl;}


}
//I've just been able to put together an array with random numbers thus far.
// How can I find the min/max/mean/sd/variance?
// I should also mention that I don't really know how to call the functions.
Using the statistics library

What library does that refer to?

with random real numbers between 1 and 100

What math calls real is more than just integers, isn't it?


Browse through the http://www.cplusplus.com/reference/algorithm/
Even if you are not permitted to use them, they (standard library algorithms) should give you ideas.
Topic archived. No new replies allowed.