1) Program a C++ function for big random number generator (bigRand(int mR[], int RANGE)) that
receives an integer array as an argument, and its size (range). The bigRand() generates non-overlapped
big random numbers in the range of 0 ~ RANGE-1 (RANGE is greater than 32,767), stores the big random number into the given array, and returns the array.
2) Program a C++ function, statArray(int mX[], int size, int& max, int& min, double& avg, double& var, double& st_dev), for finding max, min, average, variance, and standard deviation of the elements in the 1-dimensional array given as an argument. The given 1-dimensional array should be protected from
modification, and the arguments of max, min, average, variance and standard deviation should be calculated and passed to the caller function, using call-by-reference.
3) From the main() function, invoke the statArray() function, with a given 1-dimensional array, and print out the result statistics of the given 1-dimensional array: max, min, avg, var, st_dev.
1 2 3 4 5 6 7 8
|
Use following main() function.
main() function
void bigRand(int rn[], int size);
void statArray(const int mX[], int size, int& max, int& min, double& avg, double& var, double& st_dev);
void main()
cout << "Generating big rand array (size: " << SIZE_R << ")" << endl << endl;
bigRand(rn, SIZE_R);
| |