-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathkalkulator_if.cpp
More file actions
47 lines (36 loc) · 912 Bytes
/
kalkulator_if.cpp
File metadata and controls
47 lines (36 loc) · 912 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
#include <iostream>
using namespace std;
int main ()
{
float x, y;
cout << "Podaj 1 liczbe: ";
cin >> x;
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";
int wybor;
cout << "Wybierz: ";
cin >> wybor;
if (wybor == 1)
cout << "Suma = " << x + y << "\n";
else if (wybor == 2)
cout << "Roznica = " << x - y << "\n";
else if (wybor == 3)
cout << "Iloczyn = " << x * y << "\n";
else if (wybor == 4)
{
if (y == 0)
cout << "Nie dzielimy przez zero!" << "\n";
else
cout << "Iloraz = " << x / y << "\n";
}
else
cout << "Nie ma takiej opcji w menu!" << "\n";
return 0;
}