-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLabaYapis5.cpp
52 lines (45 loc) · 1.06 KB
/
LabaYapis5.cpp
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 <ctime>
using namespace std;
int main()
{
srand((int)time(0));
int n, m;
cout << "Enter the amount of rows" << endl;
cout << "n =";
cin >> n;
cout << "Enter the amount of columns" << endl;
cout << "m =";
cin >> m;
double** a = new double* [n];
for (int i = 0; i < n; i++)
a[i] = new double[m];
double** b = new double* [m];
for (int i = 0; i < m; i++)
b[i] = new double[n];
for (int i = 0; i < n; i++)
{
for (int j = 0; j < m; j++)
{
a[i][j] = rand() % 9 + 1;
b[j][i] = a[i][j];
cout << a[i][j] << " ";
}
cout << endl;
}
cout << endl;
a = b;
for (int i = 0; i < m; i++)
{
for (int j = 0; j < n; j++)
cout << a[i][j] << " ";
cout << endl;
}
for (int i = 0; i < n; i++)
delete[] a[i];
delete[] a;
for (int i = 0; i < m; i++)
delete[] b[i];
delete[] b;
return 0;
}