-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathex35.cpp
More file actions
49 lines (39 loc) · 735 Bytes
/
ex35.cpp
File metadata and controls
49 lines (39 loc) · 735 Bytes
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
/*
CPSC 121-0X
Paul De Palma
depalma
Example 35
*/
//two dimensional arrays as function arguments
#include <iostream>
#include <cmath>
using namespace std;
const int ROW = 10;
const int COL = 4;
void load(int[][COL]);
void display(int[][COL]);
int main()
{
int data[ROW][COL];
load(data);
display(data);
return 0;
}
void load(int data[0][COL])
{
for (int i = 0; i < ROW; i++)
for (int j = 0; j < COL; j++)
{
if (j == 0)
data[i][j] = i;
if (j == 1)
data[i][j] = pow(i,2);
if (j == 2)
data[i][j] = pow(i,3);
}
}
void display(int data[0][COL])
{
for (int i = 0; i < ROW; i++)
cout << data[i][0] << " " << data[i][1] << " " << data[i][2] << endl;
}