0

Hi I'm a new user of c++ and our professor gave us a homework problem where we have to find the standrad deviation, the min, the max and the avg of an array of numbers, here is what I have so far but now I'm really stuck trying to make the algorithm work for the min and max and avg.

```
#include <iostream>
#include <cmath>
using namespace std;
double mma (double Nums[], int inSize, double max[], double min[]);
double std_Dev ( double Nums[], int inSize );
double avg = 0, sDev, sum = 0, sum2 = 0;
int main ( ){
int inSize;
double Nums[100];
cout << "How many Numbers would you like to work with (max 100):";
cin >> inSize;
cout << "\nInput the numbers hit enter after each entry:";
for ( int i = 0; i < inSize; i++ ){
cin >> Nums[i];
}
sDev = std_Dev ( Nums, inSize );
mma ( Nums, inSize );
cout <<"The max, the min and the average is"<<
cout << "The Standard deviation is "<< sDev<<endl;
return 0;
}
double mma (double Nums[], int inSize, double max[], double min[]){
for ( int i = 0; i < inSize; i++ ){
if (inSize>max[i]){max[i]=inSize;}
if (inSize<min[i]){min[i]=inSize;}
sum += Nums[i];
}
avg = sum / inSize;
}
double std_Dev ( double Nums[], int inSize ){
for ( int i = 0; i < inSize; i++ ){
sum += Nums[i];
}
avg = sum / inSize;
for ( int i = 0; i < inSize; i++ ){
sum2 += pow( Nums[i] - avg, 2 );
}
sDev = sqrt( sum2 / ( inSize - 1 ) );
return sDev;
}
```

Thank you for all your help!