Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- class cube {
- public:
- double side;
- double volume() {
- return (side * side * side);
- }
- double vvod(){
- cout << endl << "Enter side value: " << endl;
- cin >> side;
- return side;
- }
- double vivod() {
- cout << endl << "Volume of the cube is " << volume() << endl << endl;
- return 0;
- }
- }s1;
- int main() {
- double volume1 = 0;
- cube c1, c2;
- cout << "Enter the length of the cube: " << endl;
- cin >> c1.side;
- cout << endl << "The volume of the cube is: " << c1.volume() << endl;
- c2.side = c1.side + 2;
- cout << "The volume of the 2nd cube is: " << c2.volume() << endl;
- s1.vvod();
- s1.vivod();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement