Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define _USE_MATH_DEFINES
- #include <iostream>
- #include <cmath>
- using namespace std;
- char type = ' ';
- int main()
- {
- cout << "P, K czy T???: ";
- cin >> type;
- if(type=='p'||type=='P')
- {
- int a = 0;
- int b = 0;
- int w = 0;
- cout << "podaj bok a: ";
- cin >> a;
- cout << "podaj bok b: ";
- cin >> b;
- w = a*b;
- cout << "Pole prostokata wynosi: " << w;
- }
- else if(type=='t'||type=='T')
- {
- int a = 0;
- int h = 0;
- int w = 0;
- cout << "podaj podstawe: ";
- cin >> a;
- cout << "podaj wysokosc: ";
- cin >> h;
- w = (a*h)/2;
- cout << "Pole trojkata wynosi: " << w;
- }
- else if(type=='k'||type=='K')
- {
- int r = 0;
- int w = 0;
- cout << "podaj promien: ";
- cin >> r;
- w = pow(r,2)*M_PI;
- cout << "Pole kola wynosi: " << w;
- }
- else
- {
- cout << "Podano nieprawidlowy znak";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement