-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDemo.cpp
More file actions
38 lines (35 loc) · 677 Bytes
/
Demo.cpp
File metadata and controls
38 lines (35 loc) · 677 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
/**
* Demo program for mat exercise.
*
* Author: Tal Zichlinsky
* Since : 2022-01
*/
#include "mat.hpp"
#include <iostream>
#include <stdexcept>
using namespace std;
int main() {
cout << ariel::mat(9, 7, '@', '-') << endl;
/* Should print:
@@@@@@@@@
@-------@
@-@@@@@-@
@-@---@-@
@-@@@@@-@
@-------@
@@@@@@@@@
*/
cout << ariel::mat(13, 5, '@', '-') << endl;
/* Should print:
@@@@@@@@@@@@@
@-----------@
@-@@@@@@@@@-@
@-----------@
@@@@@@@@@@@@@
*/
try {
cout << ariel::mat(10, 5, '$', '%') << endl; // Exception - not a valid code
} catch (exception& ex) {
cout << " caught exception: " << ex.what() << endl; // should print "Mat size is always odd"
}
}