0% found this document useful (0 votes)
27 views1 page

Lab 1 Task 01

The document contains C++ code that defines a Cube class with methods to calculate the surface area and volume of a cube based on user input for the length of one side, and uses the class to output the surface area and volume of two cubes.

Uploaded by

umer naeem
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views1 page

Lab 1 Task 01

The document contains C++ code that defines a Cube class with methods to calculate the surface area and volume of a cube based on user input for the length of one side, and uses the class to output the surface area and volume of two cubes.

Uploaded by

umer naeem
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

#include <iostream>

#include <cmath>
#include <string>
#include <iomanip>

using namespace std;

class Cube1
{
float Surface_Area;
float Volume_of_cube;
float a;

public:
void setinput()
{
cout << "Please enter the one side of cube a= " << endl;
cin >> a;
}
void Area()
{
Surface_Area = 6 * (pow(a, 2));
cout << "The Surface Area of cube is: " << Surface_Area << endl;
}

void Volume()
{
Volume_of_cube = pow(a, 3);
cout << "The Volume of cube is: " << Volume_of_cube << endl;
}
};

int main()
{

Cube1 A, B;
A.setinput();
B.setinput();
A.Area();
B.Volume();

return 0;
}

You might also like