Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //napisz program obliczający pole, obwod trojkonta kwadrat prostokont
- #include<iostream>
- #include<conio.h>
- #include<cstdlib>
- using namespace std;
- int a, b, c, h;
- char znak;
- int main()
- {
- cout<<"Podaj bok a: "; cin>>a;
- cout<<"Podaj bok b: "; cin>>b;
- cout<<"Podaj bok c: ";cin>>c;
- cout<<"Podaj wysokosc h: "; cin>>h;
- cout<<"Menu"<<endl;
- cout<<"----"<<endl;
- cout<<"1.Kwadrat"<<endl;
- cout<<"2.Prostokant"<<endl;
- cout<<"3.Trojkat"<<endl;
- znak=getch();
- switch(znak)
- {
- case'1' :
- cout<<"Pole: "<<a*a<<endl;
- cout<<"Obwod: "<<4*a<<endl;
- break;
- case '2' :
- cout<<"Pole: "<<a*b<<endl;
- cout<<"Obwod: "<<2*a+2*b<<endl;
- break;
- case '3' :
- cout<<"Pole: "<<a*h/2<<endl;
- cout<<"Obwod: "<<a+b+c<<endl;
- cout<<"Czy trojont jest prostokontny?"<<endl;
- if((a*a)+(b*b)==(c*c))
- {
- cout<<"Boki tworza trojant prostokatny";
- }
- else
- {
- cout<<"Boki nie tworza trojkonta";
- }
- break;
- default:
- cout<<"nieprawidlowe rzadanie!"<<endl;
- exit(0);
- return 0;
- }
Add Comment
Please, Sign In to add comment