Advertisement
Guest User

Untitled

a guest
Dec 17th, 2017
62
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. #include<cstdlib>
  3. using namespace std;
  4. class valjak
  5. {
  6. double r,H;
  7. public:
  8. void inic(double a, double b)
  9. {
  10. r=a;
  11. H=b;
  12. }
  13. void citaj()
  14. {
  15. cout<<"r=";
  16. cin>>r;
  17. cout<<"H=";
  18. cin>>H;
  19. }
  20. void pisi()
  21. {
  22. cout<<"r="<<r<<endl;
  23. cout<<"H="<<H<<endl;
  24. }
  25. double povrsina();
  26. double zapremina();
  27. double poredi();
  28. };
  29. double valjak::povrsina()
  30. {
  31. double p;
  32. p=2*r*r*3.14+2*r*3.14*H;
  33. return p;
  34. }
  35. double valjak::zapremina()
  36. {
  37. double v;
  38. v=r*r*3.14*H;
  39. return v;
  40. }
  41. double valjak::poredi(double e)
  42. {
  43. if(s.zapremina>e) return s.zapremina;
  44. else return e;
  45. }
  46. int main()
  47. {
  48. valjak s,p;
  49. double k,j,por;
  50. s.citaj();
  51. s.pisi();
  52. k=s.povrsina();
  53. cout<<"P="<<k<<endl;
  54. k=s.zapremina();
  55. cout<<"V="<<k<<endl;
  56. p.citaj();
  57. por=s.poredi(p.zapremina);
  58. cout<<por;
  59. system("PAUSE");
  60. return 0;
  61. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement