Need help Calling a function..Also Review my code

Specifically on line 35. I'm not sure how I would do it. And also is my declaration correct on line 15-19?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#include <iostream>
#include <fstream>

#include "tempFns.h"

using namespace std;


int main (void)
{
	// DO: declare an array of type double called temperatures 
	//     Use the constant MaxDays for the number of rows
	//     and the constant MaxTimes for the number of columns	

         double tempAvg [MaxDays]
	
	int matrix A[MaxDays][MaxTimes]
	for (i=0, i<numDays,i++)
	for (j=0, i<numTimes,i++)
		
		}
		
	int numDays = 0; // holds number of days in the month 
	int numTimes = 0; // holds number of times the temperature is measured each day
	
	// Read the data from a file
	inputFmFile (temperatures, numDays, numTimes);

	// Display the data on the screen
	cout << "Temperature data before calculating averages." << endl;
	outputData (temperatures, numDays, numTimes);
	cout << endl;
		
	// DO: Call the function tempAvg () here 
	tempAvg ()
	
	
	
	// Display the data on the screen
	cout << "Temperature data after calculating averages." << endl;
	outputData (temperatures, numDays, numTimes+1);
	cout << endl;
		
	cout << "Bye!" << endl;
	return 0;
	
}
Last edited on
lines 15,17 need ;s
line 17, a variable name cannot have a space in it.
both for loops use the same variable i (it is overwritten).
the { } around the for loops serve no purpose.
the for loops don't do anything (you probably wanted to set matrix_A[i][j] to 0, though a ; would make this valid code).
line 35, when you call a function you don't mention its return type (just tempAvg() )
the rest is fine, provided that all functions are defined.
Thanks man. I fixed it up.
Topic archived. No new replies allowed.