rygyfygy

MENU

Nov 9th, 2017
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int mojemenu(){
  6. int odp;
  7.  
  8. cout<<"\==========MENU GLOWNE===========/\n"
  9. <<"0 - wyjscie"<<endl
  10. <<"1 - pole kola"<<endl
  11. <<"2 - pole kwadratu"<<endl
  12. <<"3= pole trapezu"<<endl;
  13.  
  14. cin>>odp;
  15. return 0;}
  16.  
  17. void polekola(){
  18. float r;
  19.  
  20. cout<<"\n======[ POLE KOLA ]======\n";
  21. cout<<"r=";
  22. cin>>r;
  23.  
  24. cout<<"P="<<3.14*r*r;
  25. cout<<endl;
  26. }
  27. void poletrapezu(){
  28. float a,b,h;
  29.  
  30. cout<<"\n=======[ POLE TRAPEZU ]=======\n";
  31. cout<<"a=";
  32. cin>>a;
  33. cout<<"b=";
  34. cin>>b;
  35. cout<<"h=";
  36. cin>>h;
  37. cout<<"P=" << (a+b)*h/2;
  38. }
  39.  
  40.  
  41.  
  42. int main(){
  43.  
  44. int wybor;
  45. wybor=mojemenu();
  46. while (wybor!=0)
  47. {
  48. switch(wybor){
  49. case 1: polekola();
  50. break;
  51. case 2: poletrapezu();
  52. break;
  53. }
  54. wybor=mojemenu();
  55. }
  56.  
  57. return 0;
  58. }
Advertisement
Add Comment
Please, Sign In to add comment