i have no clue how to to start this function.
i wanted the value in the array to subtract from the average to produce the new array.
example:
1 2 3 old array
avg 2
new array -1 0 1
had a program earlier and couldnt run it because of errors.
can anyone give me a hint?
#include <iostream>
#include <cmath>
using namespace std;
const int SIZE = 100;
void readdata (double [], int &);
double findaverage (double [], int);
void howfaraway (double [], int);
int main()
{
int n;
double avg;
double mark[SIZE];
readdata(mark, n);
avg = findaverage(mark, n);
cout << avg;
return 0;
}
void readdata(double numbers[], int&n)
{
cout << "Enter the size> ";
cin >> n;
for (int count = 0; count < n; count++)
{
cout << "Enter the integer> ";
cin >> numbers[count];
}
return;
}
double findaverage (double p[], int n)
{
double sum = 0;
for (int count = 0; count < n; count++)
sum = sum + p[count];
return (double) sum / n;
}
void howfaraway (double r[], double s[], int n)
{
for (int count = 0; count < n; count++)
}