fork download
  1. #include <iostream>
  2. using namespace std;
  3. class cubiod
  4. {
  5. private:
  6. float t;
  7. float width;
  8. float height;
  9. public:
  10. void set_t(float t)
  11. {
  12. this->t=t;
  13. }
  14. void set_w(float width)
  15. {
  16. this->width=width;
  17. }
  18. void set_h(float height)
  19. {
  20. this->height=height;
  21. }
  22. float area()
  23. {
  24. return t*width*height;
  25. }
  26. void comp(cubiod &c1)
  27. {
  28. float area2=c1.t*c1.width*c1.height;
  29. if(area2>area())
  30. {
  31. cout<<"second is bigger"<<endl;
  32.  
  33. }
  34. else
  35. {
  36. cout<<"first is bigger"<<endl;
  37. }
  38.  
  39. }
  40. cubiod(float t,float width,float height)
  41. {
  42. this->t=t;
  43. this->width=width;
  44. this->height=height;
  45. }
  46.  
  47. };
  48. int main()
  49. {
  50. float t;
  51. float width;
  52. float height;
  53. cubiod c(t,width,height);
  54. cin>>t;
  55. c.set_t(t);
  56. cin>>width;
  57. c.set_w(width);
  58. cin>>height;
  59. c.set_h(height);
  60. cubiod c1(3,4,5);
  61. c.comp(c1);
  62.  
  63. return 0;
  64. }
Success #stdin #stdout 0.01s 5292KB
stdin
Standard input is empty
stdout
second is bigger