im not sure how to go about in doing. ive tried implementing some techniques ive seen but to no luck , they havent worked. Can anyone guide me to the right direction?
Code:
#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;
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;
count++;
x = userMin + inc*count;
}
}
int teco = 1;
int mode1 = 1;
int ltnum = arr2[0];
for (int index = 1; index < SIZE; index++)
{
if (ltnum == arr2[index])
{
++teco;
}
else
{
ltnum = arr2[index];
if (teco > mode1)
{
mode1 = teco;
}
teco = 0;
}
}
return 0;
}