Monday, 17 May 2021

CPP-Slip13-b

 

Create a C++ class Cuboid with data members length, breadth, and height. Write necessary member functions for the following:

1.void setvalues( float,float,floa t) to set values of data members.

11.void getvalues( ) to display values of data members.

111.float volume( ) to calculate and return the volume of cuboid.

1v.float surface_ area( ) to calculate and return the surface area of cuboid.

(Use Inline function)         

 

#include<stdio.h>

#include<conio.h>

#include<iostream.h>

class Cuboid

{

float a,b,c;

public:

void getdata()

{

cout<<"\n Enter the Details : ";

cin>>a>>b>>c;

}

void setdata()

{

cout<<a<<b<<c;

}

inline void volume()

{

cout<<"\n The volume of cuboid. =\t"<<a*b*c;

}

inline void surface_ area()

{

cout<<"\n The surface area of cuboid =\t"<<2ab+2ac+2bc;

}

};

void main()

{

clrscr();

Cuboid c;

c.getdata();

c.volume();

c.surface_ area();

getch();

}