Hello, I am working on a program that takes an integer array filled from a random number generator. These values are suppose to be from -5000 to 5000, 2500 of them. Then I want to find the standard deviation of the numbers in the array. I am required to use and integer array, calculate the average, returns the average which is a floating point value. Then I calculate the standard dev. I am having a problem with casting certain values. I am suppose to use integers and floats and I can't get it to work. I pretty sure I am suppose to use static cast but it wasn't working so I took it out. Any help would be greatly appreciated, and imput would be great too. I really want to get this working, thank you.

heres my code:

Driver

```
// AUTHOR: Page Lynn Potter
// CLASS: CIS 2275 C++ II
// PROGRAM: Quiz #1 | C++ ...Standard Deviation
// E-MAIL: ppotter03@inbox.com
// FILE: Driver.cpp
#include <iostream>
#include <iomanip>
#include "Functions.h"
using namespace std;
int main()
{
// Declared Variables
int Numbers[2500];
int Total = 2500;
float StandardDev, Mean;
// Program description, program name, & author info.
cout << "\n ----------------------------------------------------- \n";
cout << "\n C++ STATISTICAL ANALYSIS via STANDARD DEVIATION \n";
cout << "\n ----------------------------------------------------- \n";
cout << setw(15) << "\n AUTHOR: " << setw(15) << " Page Lynn Potter ";
cout << setw(17) << "\n CLASS: " << setw(5) << " CIS 2275 ";
cout << setw(10) << "\n ASSIGNMENT: " << setw(20) << " QUIZ #1 \n";
cout << "\n ----------------------------------------------------- \n";
cout << "\n This program computes two statistical values for an array "
<< "\n of 2500 values rainging in value from -5000 to +5000. ";
cout << "\n The sum and average of the values will be calculated, "
<< "\n and diplayed for viewing as well as the standard deviation. \n";
FillArray(Numbers, Total);
float Average = AveArray(Numbers, Total);
cout << setw(25) << "\n RESULTS \n";
cout << "\n ----------------------------------------------------- \n";
cout.precision(4);
cout.setf(ios::fixed);
cout << "\n AVERAGE = " << setw(10) << Mean << "\n";
float StandardDeviation = StdDeviation(Numbers, Total, Mean);
cout << "\n STANDARD DEVIATION: " << setw(10) << StandardDev << "\n";
return (0);
}
```

Functions

```
// AUTHOR: Page Lynn Potter
// CLASS: CIS 2275 C++ II
// PROGRAM: Quiz #1 | C++ ...Standard Deviation
// E-MAIL: ppotter03@inbox.com
// FILE: Functions.cpp
#include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;
void FillArray(int Numbers[], int Total)
{
srand(123);
for (int i = 0; i < Total; i++)
{
// Gives me 0 - 10000
Numbers[i] = ((rand()%10000 + 1) - 5000);
}
}
float AveArray(int Numbers[], int Total)
{
// Declared Variables
int sum = 0;
// Just to make sure there isn't any junk values.
float Mean = 0,0;
for (int i = 0; i < Total; ++i)
{
sum += Numbers[i];
}
Mean = sum/Total;
return Mean;
}
float StandardDev(int Numbers[], int Total, float Mean)
{
// Declared Variables
float StandardDev = 0.0;
int Sum2 = 0;
for (int i = 0; i < Total; ++i)
{
Sum2 += pow((Numbers[i] - Mean), 2);
}
StandardDev = sqrt(Sum2 / (Total - 1));
return StandardDev;
}
```

Header

```
// AUTHOR: Page Lynn Potter
// CLASS: CIS 2275 C++ II
// PROGRAM: Quiz #1 | C++ ...Standard Deviation
// E-MAIL: ppotter03@inbox.com
// FILE: Functions.h
#include <iostream>
using namespace std;
/* The FillArray() is passed the integer array and total number
(size) of the array. It then uses rand() to fill the array
with values from -5000 to +5000. */
void FillArray(int Numbers[], int Total);
/* The AveArray() calculates the average (mean) of the array.
It is passed the array, total number (size) and returns, a
floating point value. */
float AveArray(int Numbers[], int Total);
/* The StandardDec() is passed the array, array size, and the
average (mean) value. It then calculates and returns the
standard deviation. */
float StandardDev(int Numbers[], int Total, float Mean);
```