I guess what i need to figure out is how to do this program. but i need to make the functions call by address. any help would be great.
#include <iostream>
#include <fstream>
using namespace std;
int findLarge(int x[])
{
int i = 0;
int largest = -99999;
while (i < 9)
{
if (largest < x[i])
largest = x[i];
i=i + 1;
}
return largest;
}
double calAverage(int x[])
{
int i = 0;
double avg = 0.0;
while (i<9)
{
avg += x[i];
i++;
}
return avg/9;
}
int main()
{
int a[9], i=0, total=0, average=0, lgst=0;
ifstream file1;
ofstream file2;
file1.open("quiz5data.txt", ios::in);
file2.open("quiz5output.txt");
if(file1.is_open()==true)
for(i=0;i<9;i++)
file1 >> a[i];
findLarge(a);
calAverage(a);
file2<< "Largest = " << findLarge(a) << endl;
cout << "Largest = " << findLarge(a) << endl;
cout << "Avg = " << calAverage(a) << endl;
file2<< "Avg = " << calAverage(a) << endl;
return 0;
}