-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
36 lines (26 loc) · 778 Bytes
/
main.cpp
File metadata and controls
36 lines (26 loc) · 778 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
#include <iostream>
#include "matrix.cpp"
#include "matrix.h"
int main() {
while (true) {
try {
int n = input();
matrix inputmat = create(n);
matrix outputmat = createnew(n);
copymod(inputmat, outputmat);
std::cout << "\nDisplay before swap:\n";
display(inputmat);
std::cout << "\nDisplay after swap:\n";
display(outputmat);
free(inputmat);
free(outputmat);
break;
} catch (const std::runtime_error& e) {
std::cout << e.what() << std::endl;
}
catch (const std::bad_alloc& ex){
std::cerr << "Not enough memory" << std::endl;
}
}
return 0;
}