-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFractionCalculator.cpp
More file actions
48 lines (43 loc) · 904 Bytes
/
FractionCalculator.cpp
File metadata and controls
48 lines (43 loc) · 904 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
39
40
41
42
43
44
45
46
47
48
#include "FractionCalculator.h"
#include "Fraction.h"
FractionCalculator::FractionCalculator()
{
//ctor
}
FractionCalculator::FractionCalculator (Fraction &f)
{
Fraction r;
int choose;
cout << "enter the fraction that you want to do process with " <<endl;
cin >>r;
cout << "which process you want to do :"<< "1- add \n 2- subtract \n 3- multi \n 4- divide \n";
cin >> choose;
if (choose ==1)
{
Fraction a=r+f;
a.reducing();
cout << a;
}
if (choose ==2)
{
Fraction a=r-f;
a.reducing();
cout << a;
}
if (choose ==3)
{
Fraction a=r*f;
a.reducing();
cout << a;
}
if (choose ==4)
{
Fraction a=r/f;
a.reducing();
cout << a;
}
}
FractionCalculator::~FractionCalculator()
{
//dtor
}