-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLab3Utils.cpp
More file actions
41 lines (35 loc) · 826 Bytes
/
Lab3Utils.cpp
File metadata and controls
41 lines (35 loc) · 826 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
#include "Lab3Utils.h"
#include <iostream>
#include <stdlib.h>
using namespace std;
int** Lab3Utils::create_mx(int m, int n) {
int** result = new int* [m];
for (int i = 0; i < m; i++) {
result[i] = new int[n];
}
return result;
}
void Lab3Utils::init_mx(int m, int n, int** mx) {
int temp = 0;
for (int i = 0; i < m; i++) {
for (int j = 0; j < n; j++) {
cout << "Enter mx[" << i + 1 << "][" << j + 1 << "] :" << endl;
cin >> mx[i][j];
}
}
}
void Lab3Utils::init_mx_random(int m, int n, int** mx) {
for (int i = 0; i < m; i++) {
for (int j = 0; j < n; j++) {
mx[i][j] = rand() % 10;
}
}
}
void Lab3Utils::show_mx(int m, int n, int** mx) {
for (int i = 0; i < m; i++) {
for (int j = 0; j < n; j++) {
cout << mx[i][j] << " ";
}
cout << endl;
}
}