-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDemo.cpp
95 lines (80 loc) · 1.62 KB
/
Demo.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
/*
* Demo program for Exercise 2.
* Author: Tal Hadary.
*/
#include "Graph.hpp"
#include "Algorithms.hpp"
using ariel::Algorithms;
using ariel::Graph;
using namespace std;
int main()
{
Graph g1;
Graph g2;
Graph g3;
vector<vector<int>> graph1 =
{{1, 0, 0, 0},
{0, -2, 0, 3},
{0, 0, 3, 5},
{0, 0, 0, 0}};
g1.loadGraph(graph1);
vector<vector<int>> graph2 =
{{0, 0, 0, 0},
{0, -2, 0, -3},
{1, 1, 3, 5},
{0, -10, 0, 0}};
g2.loadGraph(graph2);
vector<vector<int>> graph3 =
{{0, 1, 1, 0},
{1, 0, 0, 1},
{1, 0, 0, 1},
{0, 1, 1, 0}};
g3.loadGraph(graph3);
Graph g4;
cout << "g1 + g2 = g4\n"
<< endl;
g4 = g1 + g2;
cout << g4 << endl;
cout << "g1 - g2 = g4\n"
<< endl;
g4 = g2 - g3;
cout << g4 << endl;
cout << "g3\n"
<< endl;
cout << g3 << endl;
cout << "g3 += 5\n"
<< endl;
cout << g3 << endl;
g3 += 5;
cout << g3 << endl;
cout << "g3 -= 5\n"
<< endl;
g3 -= 5;
cout << g3 << endl;
cout << "++g1\n--g2\n"
<< endl;
++g1;
--g2;
cout << g1 << endl;
cout << g2 << endl;
cout << "g2++\ng1--\n"
<< endl;
g2++;
g1--;
cout << g1 << endl;
cout << g2 << endl;
cout << "+g1\n-g2\n"
<< endl;
+g1;
-g2;
cout << g1 << endl;
cout << g2 << endl;
cout << "g4 = g3 * 9\n"
<< endl;
g4 = g3 * 9;
cout << g3 << endl;
cout << "g4 = g1 * g2\n"
<< endl;
g4 = g1 * g2;
cout << g4 << endl;
}