-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcomplex switch programe.cpp
More file actions
170 lines (148 loc) · 4.14 KB
/
Copy pathcomplex switch programe.cpp
File metadata and controls
170 lines (148 loc) · 4.14 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
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
#include <iostream>
#include <windows.h>
#include <cmath>
using namespace std;
int main()
{
char team;
int a, b, c, d, e, f, h, m, s, err;
float x, y, r;
cout << "Select any of the following: " << endl;
cout<< "Enter P to round a number" << endl;
cout<< "Enter I to get sum of two numbers" << endl;
cout<< "Enter A to multiply any two numbers" << endl;
cout<< "Enter E to get remainder after division" << endl;
cout<< "Enter B to get area of circle if radius is known" << endl;
cout<< "Enter a for power function" << endl;
cout<< "Enter S to find about weather" << endl;
cout<< "Enter N to set the clock" << endl;
cout<< "Enter W for car parking program" << endl;
cout<< "Enter Z to find area of rectangle " << endl;
cout<< "THE LETETR YOU ENTERED IS: " << endl;
cin >> team;
switch (team)
{
//case P
case 'P':
cout <<"Enter a decimal number" << endl;
cin >>x;
cout <<"the number is rounded to: " <<round(x);
cout <<endl;
break;
//case I
case 'I': cout<<"Enter any two integers to get the sum: "<<endl;
cin >> a>> b;
c =a+b;
cout << "The sum of two numbers is: " << c << endl;
break;
//case S
case 'S' : cout << "Enter the temperature: "<<endl;
cin >> x;
if (x<=5)
cout<< "The temperature is cool" << endl;
else if ( (x> 5) && (x<13 ))
cout << "The temperature is moderate: " << endl;
else
cout << "The temperature is hot" << endl;
break;
//case E
case 'E' : cout << "Enter two numbers to get remainder 0 or other than 0 :"<<endl;
cout << "Enter first number:"<<endl;
cin >> a ; cout << "Divided by "; cin >> b;
c= a%b;
cout << a <<"%" << b << " = " << c << " REMAINDER IS: " << c << endl;
if(c==0)
cout << true << endl;
else
cout << false << endl;
cout << (x>y);
break;
//case A
case 'A': cout<< "Enter any two integers to multiply"<<endl;
cin>> a>> b;
c=a*b;
cout << "the result is :" << c<< endl;
break;
//caseB
case 'B' : cout << "Enter the radius of the circle" << endl;
cin >> r;
cout << "Area of Circle = "<< 3.14*r*r << endl;
break;
//case a
case 'a':
cout << "Enter first nuber as a base and second as power:" << endl;
cin >> a >> b;
c = pow(a, b);
cout << "Your answer is : " << c << endl;
break;
//case W
case 'W':
cout<< "Enter number of rickshaws:" << endl;
cin >> a;
cout << "Enter number of buses:" << endl;
cin >> b;
cout << "Enter number of cars:" << endl;
cin >> c;
cout <<"Number of Rickshaws:" << a << endl;
cout << "Amount : Rs" << a*100 << endl;
e = a*100;
cout <<"Number of cars: "<< c << endl;
cout <<"Amount : Rs" << c*200 << endl;
d=c*200;
cout << "Number of buses: " << b << endl;
cout << "Amount : Rs" << b* 300 << endl;
f=b*300;
cout <<"*********************************" <<endl;
cout << "Total Amount : " << e+d+f << endl;
cout <<"*********************************" <<endl;
break;
//case N
case 'N':
err = a= 0;
while ( err==0)
{
cout << "Enter hours:" <<endl;
cin >> h;
cout << "Enter minutes:" << endl;
cin >> m;
cout << "Eneter seconds: " << endl;
cin >> s;
if(h<24&&m<60&&s<60)
err++;
system ("cls");
}
while(a==0)
{
system ("cls");
cout << h <<":" << m << ":" << s << ":" << endl;
Sleep (1000);
s++;
if(s>59)
{
s=0;
m++;
}
if(m>59)
{
m=0;
h++;
}
if(h>24)
{
h=0;
}
}
break;
//case Z
case 'Z' : cout << "Area of rectangle:" << endl;
cout << "Enter lenght: ";
cin >> a;
cout << "Enter width: ";
cin >> b;
cout << "AREA OF RECTANGLE =" << a*b << endl;
break;
default: cout<<"You entered a wrong team ... Try again"<<endl;
}
cout<<" ********************Hey, I'm out of the switch case***************************";
return 0;
}