Advertisement
Marisichka

Untitled

Sep 28th, 2021
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.66 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3. using namespace std;
  4.  
  5. class cube {
  6.  
  7. private:
  8.  
  9.     double side;
  10.  
  11.    double volume() {
  12.         return pow(side, 3);
  13.     }
  14.  
  15.  
  16. public:
  17.     int n;
  18.  
  19.     void vvod() {
  20.        
  21.         cout << "Введите длину куба: ";
  22.         cin >> side;
  23.  
  24.         cout << endl;
  25.  
  26.     }
  27.     void vivod() {
  28.  
  29.         cout << "Объем куба: " << volume() << endl;
  30.  
  31.         cout << endl;
  32.     }
  33. };
  34.  
  35. int main() {
  36.  
  37.     cube c1, c2;
  38.  
  39.     cout << "Первый куб:" << endl;
  40.     c1.vvod();
  41.     c1.vivod();
  42.  
  43.     cout << "Второй куб:" << endl;
  44.     c2.vvod();
  45.     c2.vivod();
  46.  
  47.     return 0;
  48. }
  49.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement