Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstdlib>
- #include <math.h>
- #include <string>
- using namespace std;
- int main()
- {
- long double a, b;
- char op, cos;
- cout << "Operatory: " << endl;
- cout << "1. Dodawanie +" << endl;
- cout << "2. Odejmowanie -" << endl;
- cout << "3. Mnozenie *" << endl;
- cout << "4. Dzielenie /" << endl;
- cout << "5. Potegowanie: Liczba ^ Potega" << endl;
- cout << "6. Pierwiastkowanie: Stopien # Potegowana liczba" << endl;
- poczatek:
- while (true) {
- if (cin.good()) {
- cin >> a >> op >> b;
- switch (op) {
- case '+': cout << a + b << '\n' << '\n' << '\n' << '\n' << '\n'; break;
- case '-': cout << a - b << '\n' << '\n' << '\n' << '\n' << '\n'; break;
- case '*': cout << a * b << '\n' << '\n' << '\n' << '\n' << '\n'; break;
- case '/': cout << a / b << '\n' << '\n' << '\n' << '\n' << '\n'; break;
- case '^': cout << pow(a, b) << '\n' << '\n' << '\n' << '\n' << '\n'; break;
- case '#': cout << pow(b, 1 / a) << '\n' << '\n' << '\n' << '\n' << '\n'; break;
- }
- }
- else {
- cout << "Wprowadziles litere zamiast cyfry" << endl;
- return 0;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement