-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdriver.cpp
54 lines (34 loc) · 889 Bytes
/
driver.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
#include "Rational.h"
#include "helper.h"
#include <iostream>
using namespace std;
void print(const RatNum& r) {
cout << r.str() << endl;
}
int main() {
RatNum num1 = RatNum(4);
RatNum num2 = RatNum();
RatNum num3 = RatNum(34, -7);
RatNum num4 = RatNum(-42, 0);
RatNum sum1 = num1 + num2;
RatNum sum2 = num3 + num4;
RatNum dif1 = num1 - num2;
RatNum dif2 = num3 - num4;
RatNum prod1 = num1 * num2;
RatNum prod2 = num3 * num4;
RatNum quo1 = num1 / num2;
RatNum quo2 = num3 / num4;
cout << num1 << endl;
cout << num2 << endl;
cout << num3 << endl;
cout << num4 << endl;
cout << sum1 << endl;
cout << sum2 << endl;
cout << dif1 << endl;
cout << dif2 << endl;
cout << prod1 << endl;
cout << prod2 << endl;
cout << quo1 << endl;
cout << quo2 << endl;
return 0;
}