-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgauss.cpp
More file actions
53 lines (35 loc) · 951 Bytes
/
gauss.cpp
File metadata and controls
53 lines (35 loc) · 951 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
50
51
52
#include <iostream>
#include <stdlib.h>
using namespace std;
void augumentedArray(int *a, int *b, int *c) {
for(int i = 0; i < 3; i++) {
for(int j = 0; j < 4 ; j++) {
if(j == 3) {
*((c + i * 4) + j) = *((b + i) + 0);
continue;
}
*((c + i * 4) + j) = *((a + i * 3) + j);
}
}
}
void matrixTraverser(int* matrix, int size) {
for(int i=0; i < 3; i++) {
cout << endl;
for(int j =0; j < 4; j++)
cout <<*((matrix+i*4) + j) << "\t";
}
}
int main() {
system("cls");
int a[3][3] = {{1,2,3},{4,5,6},{7,8,9}};
int b[3][1] = {14,15,16};
int c[3][4];
// int *d = &a[0][0];
// cout << *((d + 2 * 4)+ 3);
augumentedArray(&a[0][0], &b[0][0], &c[0][0]);
matrixTraverser(&c[0][0], 3);
// delete(a);
// delete(b);
// delete(c);
return 0;
}