-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTask2_main.cpp
More file actions
53 lines (40 loc) · 1.18 KB
/
Task2_main.cpp
File metadata and controls
53 lines (40 loc) · 1.18 KB
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
/**
* @file Task3_main.cpp
*
* @brief This code implements operator overloading
* concepts in C++ using RationalNumber class.
*
* @author Saif Ullah Ijaz
*
*/
// SYSTEM INCLUDES
#include <iostream>
using namespace std;
// LOCAL INCLUDES
#include "RationalNumber.h"
// function main begins program execution
void main() {
RationalNumber r1(4, 9), r2(2, 3), r3;
cin >> r1 >> r2 >> r3;
cout << "First Rational Number: " << r1 << endl;
cout << "Second Rational Number: " << r2 << endl;
cout << "Third Rational Number: " << r3 << endl << endl;
cout << "Addition: " << r1 + r2 + r3 << endl;
cout << "Subtraction: " << r1 - r2 - r3 << endl;
cout << "Multiplication: " << r1 * r2 * r3 << endl;
cout << "Division: " << r1 / r2 / r3 << endl << endl;
if (r1 == r2)
cout << "r1 is equal to r2" << endl;
if (r1 != r2)
cout << "r1 is not equal to r2" << endl;
if (r1 < r2)
cout << "r1 is less than r2" << endl;
if (r1 <= r2)
cout << "r1 is less than or equal to r2" << endl;
if (r1 > r2)
cout << "r1 is greater than r2" << endl;
if (r1 >= r2)
cout << "r1 is greater than or equal to r2" << endl;
system("pause");
}
// end main