Question
1.
#include
2.
using namespace std;
3.
class Box
4.
{
5.
public :
6.
double length;
7.
double breadth;
8.
double height;
9.
};
10.
int main( )
11.
{
12.
Box Box1;
13.
double volume;
14.
Box1.height = 5;
15.
Box1.length = 6;
16.
Box1.breadth = 7.1;
17.
volume = Box1.height * Box1.length * Box1.breadth;
18.
cout
What is the output of the following program?
1.
#include
2.
using namespace std;
3.
class Box
4.
{
5.
public :
6.
double length;
7.
double breadth;
8.
double height;
9.
};
10.
int main( )
11.
{
12.
Box Box1;
13.
double volume;
14.
Box1.height = 5;
15.
Box1.length = 6;
16.
Box1.breadth = 7.1;
17.
volume = Box1.height * Box1.length * Box1.breadth;
18.
cout
Answer: Option B
Was this answer helpful ?
In the above program, we are calculating the area of the cube by using the cube formula
Output:
$ g++ obj1.cpp
$ a.out
213
Was this answer helpful ?
More Questions on This Topic :
Question 2.
How to access the object in the class?
....
Question 3.
Where does the object is created?
....
Submit Solution