Advertisement
Marisichka

Untitled

Sep 17th, 2021
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.70 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. class cube {
  5.  
  6. public:
  7.     double side;
  8.  
  9.     double volume() {
  10.         return (side * side * side);
  11.     }
  12.  
  13.     double vvod(){
  14.  
  15.         cout << endl << "Enter side value: " << endl;
  16.         cin >> side;
  17.  
  18.         return side;
  19.     }
  20.  
  21.     double vivod() {
  22.  
  23.         cout << endl << "Volume of the cube is " << volume() << endl << endl;
  24.  
  25.         return 0;
  26.     }
  27. }s1;
  28.  
  29.  
  30.  
  31. int main() {
  32.  
  33.     double volume1 = 0;
  34.     cube c1, c2;
  35.  
  36.     cout << "Enter the length of the cube: " << endl;
  37.     cin >> c1.side;
  38.  
  39.     cout << endl << "The volume of the cube is: " << c1.volume() << endl;
  40.     c2.side = c1.side + 2;
  41.     cout << "The volume of the 2nd cube is: " << c2.volume() << endl;
  42.  
  43.     s1.vvod();
  44.     s1.vivod();
  45.  
  46.     return 0;
  47.  
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement