-
Notifications
You must be signed in to change notification settings - Fork 0
/
bettercalculator.cpp
82 lines (80 loc) · 1.87 KB
/
bettercalculator.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
#include <iostream>
#include <cmath>
using namespace std;
int main () {
int q;
cout<<"What do you want to do : \n1. Operations with numbers \n2. Square numbers \n3. Square Root \n";
cin>>q;
if (q==2)
{
int n,m;
cout<<"Enter one number you want to square : \n";
cin>>n;
cout<<"Enter the degree with which you want to square the number : \n";
cin>>m;
cout<<"Square : \n"<<pow(n,m);
}
else if (q==3)
{
int n;
cout<<"Enter one number you want to square root : \n";
cin>>n;
cout<<"Square root : \n"<<sqrt(n);
}
if (q==1)
{
int p;
cout<<"Select with which numbers you want to perform operations : \n1. Integers \n2. Decimals \n";
cin>>p;
if (p==1)
{
int x,y,o;
cout<<"Enter two numbers : \n";
cin>>x>>y;
cout<<"What operation do u want : \n";
cout<<"\n1. Addition \n2. Substraction \n3. Multiplication \n4. Division \n";
cin>>o;
if (o==1)
{
cout<<"Sum : \n"<<x+y<<endl;
}
else if (o==2) {
cout<<"DIffrence : \n"<<x-y<<endl;
}
if (o==3)
{
cout<<"Multiplication : \n"<<x*y<<endl;
}
else if (o==4)
{
cout<<"Quotient : \n"<<x/y<<endl;
}
}
else if (p==2)
{
float x,y,o;
cout<<"Enter two numbers : \n";
cin>>x>>y;
cout<<"What operation do u want : \n";
cout<<"\n1. Addition \n2. Substraction \n3. Multiplication \n4. Division \n";
cin>>o;
if (o==1)
{
cout<<"Sum : \n"<<x+y<<endl;
}
else if (o==2) {
cout<<"DIffrence : \n"<<x-y<<endl;
}
if (o==3)
{
cout<<"Multiplication : \n"<<x*y<<endl;
}
else if (o==4)
{
cout<<"Quotient : \n"<<x/y<<endl;
}
}
}
system("pause");
return 0;
}