having trouble with arrays

closed account (Lhp9GNh0)
Im trying to wirte 5 functions GETDATA: that reads in the two dimensional array;
average high that calulates and returns the average high temp; the average low temp that calulates and returns the average low temp; index high temp that returns the index or high temps; index low temp that returns the index of low temps;

This is what i got so far......
#include <iostream>
#include <iomanip>
#include <fstream>
#include <string>
#include <cstdlib>

using namespace std;

hiavg (ifstream& ch9, ofstream& ch9a, int& temparray [12][2], avg1);
loavg (ifstream& ch9, ofstream& ch9a, int& temparray [12][2], avg2);
hitemp(ifstream& ch9, ofstream& ch9a, int& temparray [12][2], ht);
lotemp(ifstream& ch9, ofstream& ch9a, int& temparray [12][2], lt);

int main ()
{
ifstream infile;
ofstream outfile;
infile.open ("e:\\ch9.txt");
outfile.open ("e:\\ch9a.txt");

outfile << fixed << showpoint << setprecision(2);
outfile << "Joseph Sidbury";
outfile << endl;

infile.close();
outfile.close();

system("Pause");
return 0;
}

hiavg (ifstream& ch9, ofstream& ch9a, int& temparray [12][2], avg1)
{
Int sum, index, avg1;
Int hitemp index;
sum = 0
for (index = 0; index <12; index++)
sum = sum + hitemp [index]

avg1 = sum /12

return avg1;

}
loavg (ifstream& ch9, ofstream& ch9a, int& temparray [12][2], avg2);
{
Int sum, index, avg2;
Int lotemp [index];

sum = 0
for (index = 0; index < 12; index++)
sum = sum + lotemp [index]

avg2 = sum /12

return avg2;
}
hitemp(ifstream& ch9, ofstream& ch9a, int& temparray [12][2], ht);
{
Int temparray [maxIndex];
Int temparray [index];
Int index, maxIndex
Int ht;

Maxindex = 0
For (index = 1; index <12; index++)
If (temparray [maxIndex] < temparray [index])
maxIndex = index;
largesttemp = temparray[maxindex]
return ht;
}

lotemp(ifstream& ch9, ofstream& ch9a, int& temparray [12][2], lt);
{
Int temparray [maxIndex];
Int temparray [index];
Int index, maxIndex
Int lt;

Maxindex = 0
For (index = 1; index <12; index++)
If (temparray [maxIndex] > temparray [index])
maxIndex = index;
largesttemp = temparray[maxindex]
retun lt;
}
Last edited on
Please use [code][/code] tags.

You are not specifying the return types on the function declarations.
The function implementations show void but return int ( Notice: int is lowercase as if and for)
Topic archived. No new replies allowed.