Created
December 2, 2016 22:29
-
-
Save Mati365/b9c2f38d76820116e34b2b7008cb1ed5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
int main() { | |
while(true) { | |
cout | |
<< "Pola powierzchnii figur" << endl | |
<< "1 - prostokat" << endl | |
<< "2 - kolo" << endl | |
<< "3 - trojkat" << endl | |
<< "4 - trapez" << endl | |
<< "5 - koniec programu" << endl; | |
int o = 0; | |
cin >> o; | |
switch(o) { | |
case 1: { | |
float a; cout << "a:"; cin >> a; | |
float b; cout << "b:"; cin >> b; | |
cout << "pole: " << a * b << endl; | |
} break; | |
case 2: { | |
float r; cout << "Podaj promien kola: "; cin >> r; | |
cout << "pole: " << 3.14 * r * r << endl; | |
} break; | |
case 3: { | |
float a; cout << "a:"; cin >> a; | |
float h; cout << "h:"; cin >> h; | |
cout << "pole: " << 1.f / 2.f * a * h << endl; | |
} break; | |
case 4: { | |
float a; cout << "a:"; cin >> a; | |
float b; cout << "b:"; cin >> b; | |
float h; cout << "h:"; cin >> h; | |
cout << "pole: " << (a + b) * h / 2.f << endl; | |
} break; | |
default: | |
return 1; | |
} | |
cin.get(); | |
cout << endl; | |
} | |
return 1; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment