Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- char x;
- int a, b;
- int pole = 0;
- cout << "Podaj litere a,b,c lub d" << endl;
- cin >> x;
- switch (x)
- {
- case 'a':
- cout << "Podaj dlugosc pierwszego boku" << endl;
- cin >> a;
- cout << "Podaj dlugosc drugiego boku" << endl;
- cin >> b;
- pole = a * b;
- cout << "Pole prostokata wynosi : " << pole << endl;
- break;
- case 'b':
- cout << "Podaj dlugosc boku" << endl;
- cin >> a;
- pole = a * a;
- cout << "Pole kwadratu wynosi : " << pole << endl;
- break;
- case 'c':
- cout << "Podaj dlugosc podstawy" << endl;
- cin >> a;
- cout << "Podaj dlugosc wysokosci" << endl;
- cin >> b;
- pole = 0.5 * a * b;
- cout << "Pole trojkata wynosi : " << pole << endl;
- break;
- case 'd':
- cout << "Podaj dlugosc promienia kola" << endl;
- cin >> a;
- pole = 3.14 * (a* a);
- cout << "Pole kola wynosi: " << pole << endl;
- default:
- cout << "Podano zla litere" << endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment