-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlocation_lab.cpp
More file actions
39 lines (36 loc) · 874 Bytes
/
Copy pathlocation_lab.cpp
File metadata and controls
39 lines (36 loc) · 874 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
/*
Locationa[i][j]=Base_Address+((i*c)+j)*size of array type
write a program to do 1/read two diemntional size 3 w 4 2/print array matrix element 3/write a functin to find and return location
of a specified elemnt usig row wise methos base address=400
*/
#include <iostream>
using namespace std;
void location(int i, int j, int r, int ba);
int main() {
short a[3][4];
for (int i = 0;i < 3;i++)
for (int j = 0;j < 4;j++)
cin >> a[i][j];
for (int i = 0;i < 3;i++)
{
for (int j = 0;j < 4;j++)
cout << a[i][j] << " ";
cout << endl;
}
int i ,j;
cout << "enter the i number" << endl;
cin >> i;
cout << "enter the j number" << endl;
cin >> j;
location(i, j, 4, 400);
return 0;
}
void location(int i, int j, int c, int ba) {
//colomnways
cout << location << endl;
cout << (ba + ((i * 4) + j) * 4);
/*
rowways
cout << (ba + ((j * 3) + i) * 4);
*/
}