-
Notifications
You must be signed in to change notification settings - Fork 0
/
Simple_Calculator---CodSoft_Task-2.cpp
63 lines (58 loc) · 1.88 KB
/
Simple_Calculator---CodSoft_Task-2.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
#include<bits/stdc++.h>
#include<iostream>
using namespace std;
int main()
{
int i;
do
{
cout << "\n---------------------- WELCOME TO MY SIMPLE CALCULATOR ----------------------\n" << endl;
int a, b;
int op;
cout << "Enter two number seperated by spaces : ";
cin >> a;
cin >> b;
cout << "\n-----------------------------------------------------------------------------\n" << endl;
cout << "Press 1 for Addition (+) >>>" << endl;
cout << "Press 2 for Subtraction (-) >>>" << endl;
cout << "Press 3 for Multiplication (*) >>>" << endl;
cout << "Press 4 for Division-Quotient (/) >>>" << endl;
cout << "Press 5 for D-Remainder (%) >>>" << endl;
cout << "Press 6 for Power (^) >>>" << endl;
cout << "\nSelect any Operation : ";
cin >> op;
cout << "\nYour Answer is : ";
switch (op)
{
case 1:
cout << (a + b) << endl;
break;
case 2:
cout << (a - b) << endl;
break;
case 3:
cout << (a * b) << endl;
break;
case 4:
cout << (a / b) << endl;
break;
case 5:
cout << (a % b) << endl;
break;
case 6:
cout << pow(a , b) << endl;
break;
default:
cout << "Operation not Found...! Please Try Again...\n";
break;
}
cout << "\n-----------------------------------------------------------------------------\n" << endl;
cout << "Press 1 for Continue >>>" << endl;
cout << "Press 0 for End >>>" << endl;
cout << "\nAre You want to Continue? (1/0) : ";
cin >> i;
}
while (i);
cout << "\nThank You for using this Calculator...!\n";
return 0;
}