-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathKalkulator.cpp
More file actions
55 lines (43 loc) · 1.16 KB
/
Kalkulator.cpp
File metadata and controls
55 lines (43 loc) · 1.16 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
#include <iostream>
#include <string>
using namespace std;
int main()
{
cout << "---------------------" << endl;
cout << "Kalkulator" << endl;
cout << "by Mateusz Kawka" << endl;
cout << "All rights reserved" << endl;
cout << "---------------------" << endl;
double zm1, zm2;
poczatek:
cout << "Podaj pierwsza liczbe" << endl;
cin >> zm1;
cout << "Podaj druga liczbe" << endl;
cin >> zm2;
char znak;
cin >> znak;
switch (znak)
{
case '+':
cout << zm1 << " + " << zm2 << " = " << (zm1 + zm2) << endl;
break;
case '-':
cout << zm1 << " - " << zm2 << " = " << (zm1 - zm2) << endl;
break;
case '*':
cout << zm1 << " * " << zm2 << " = " << (zm1 * zm2) << endl;
break;
case '/':
if (zm2 != 0)
cout << zm1 << " / " << zm2 << " = " << (zm1 / zm2) << endl;
else
cout << "Cholero nie dziel przez zero ;) " << endl;
break;
}
string znak2;
cout << "Czy chcesz kontyunowac program? (T/N)" << endl;
cin >> znak2;
if (znak2 == "t" || znak2 == "T")
goto poczatek;
system("pause");
}