-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathkalkulator_switch.cpp
More file actions
58 lines (47 loc) · 1.21 KB
/
kalkulator_switch.cpp
File metadata and controls
58 lines (47 loc) · 1.21 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
#include <iostream>
using namespace std;
int main ()
{
char wybor = 'e';
while (true)
{
float x;
cout << "Podaj 1 liczbe: ";
cin >> x;
float y;
cout << "Podaj 2 liczbe: ";
cin >> y;
cout << "\n";
cout << "MENU GLOWNE" << "\n";
cout << "-----------------" << "\n";
cout << "1. Dodawanie" << "\n";
cout << "2. Odejmowanie" << "\n";
cout << "3. Mnozenie" << "\n";
cout << "4. Dzielenie" << "\n";
cout << "5. Koniec programu" << "\n";
cout << "\n";
cin >> wybor;
switch (wybor)
{
case '1':
cout << "Suma = " << x + y << "\n";
break;
case '2':
cout << "Roznica = " << x - y << "\n";
break;
case '3':
cout << "Iloczyn = " << x * y << "\n";
break;
case '4':
if (y == 0)
cout << "Nie dzielimy przez zero!\n";
else
cout << "Iloraz = " << x / y << "\n";
break;
case '5':
return 0;
default:
cout << "Nie ma takiej opcji w menu!\n";
}
}
}