so im trying to find the min, max, range, mean, median, and mode. The max number is right but the min isnt. Once that is corrected, i can get range and mean easily. Also, i have no idea how to get mode and median. Im guessing the values in the arr2 would have to be sorted. Any thoughts? Id appreciate it.

This refers to the values in arr2 which are the calculated values in the formula. You can enter -2 and 2 for userMin and userMax.

```
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
cout << fixed << setprecision(1);
float userMin;
float userMax;
const int SIZE = 21;
float arr[SIZE];
const int SIZE2 = 21;
float arr2[SIZE2];
int count = 0;
cout << "enter min ";
cin >> userMin;
cout << "enter max ";
cin >> userMax;
float inc = (userMax - userMin) / (SIZE-1);
float x = inc*count + userMin;
double total = 0;
double mn=arr2[0];
double mx=arr2[0];
float range;
float median;
float mode;
for (; x <= userMax;)
{
for (int e = 0; e < SIZE; e++)
{
arr[e] = x;
arr2[e] = (0.0572*cos(4.667*x) + 0.0218*cos(12.22*x));
cout << setw(15) << setprecision(1)<< arr[e]
<< setw(15) << setprecision(3) << arr2[e]
<< endl;
total += arr2[e];
count++;
x = userMin + inc*count;
if (mn > arr2[e])
{
mn = arr2[e];
}
if (mx < arr2[e])
{
mx = arr2[e];
}
}
}
cout << endl;
cout << "min " << mn << endl;
cout << "max " << mx << endl;
//cout << "mode" << mode << endl;
//cout << "median " << median << endl;
cout << "mean " << total / SIZE << endl;
cout << "range " << mx - mn << endl;
return 0;
}
```