Pass an array through a function?

Please help me pass line 16 through line 39 into my function! I have no idea how to do this I have tried so many unsuccessful ways!
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
48
49
50
51
52
53
54
55
56
#include <iostream> 
#include <iomanip>
#include <cmath>


using namespace std;

int grade(int win[5][7]);
int study = 0;
int main(){
const int ROWS = 5;
const int COLS = 7;
int table[ROWS][COLS]={{1,100,100,100,100,0,0},{2,100,0,100,0,0,0},{3,82,94,73,86,0,0},{4,64,74,84,94,0,0},{5,94,84,74,64,0,0}};
int total = grade(table);

const int hi = 5;
const int wide = 7;
const int left = 4;
const int right = 6;
const int small = 5;
const int big = 7;

int average= 0;
cout << "\tStudent" << "\tGrade1" << "\tGrade2" << " \t   Grade3" << "    Grade4" << "   Average" << " \tStandard Dev" << endl;
cout <<"________________________________________________________________________________";
for(int i = 0;i < hi;i++){
	for(int j=0;j < wide;j++){
		if(left < j < right)
			table[i][5]=(table[i][1]+table[i][2]+table[i][3]+table[i][4])/4;
		if(small < j < big)
		table [i][6]=(.3*table[i][1])+(.2*table[i][2])+(.2*table[i][3])+(.3*table[i][4]);        //0.3*grade1	+	0.2	*grade2	+	0.2	*	grade3	+	0.3 *	grade4
		
		
		cout << setiosflags(ios::fixed) << setw(10)<<table[i][j];
		
	}
	
	cout << endl;
	}



cout << "the av is " << total;





system("pause");
}

int grade(int win[5][7]){
int average= 0;
average+=(win[0][1]+win[0][2]+win[0][3]+win[0][4])/4;
return average;	
}
Last edited on
Topic archived. No new replies allowed.