Standard Template Library (STL) Question:

Write a c++ to define a class box with length, breadth and height as data member and input value(), printvalue() and volume() as member functions?

Standard Template Library (STL) Interview Question
Standard Template Library (STL) Interview Question

Answer:

#include<iostream.h>
#include<conio.h>

class BOX
{
private:
int l,b,h;
public:
void input();
void print();
long volume(long,int,int);
};
void BOX::input()
{
cout<<"input values of l,b,&h"<<"\n";
cin>>l>>b>>h;
}
void BOX::print()
{
cout<<"volume="<<"\n";
}
void BOX::volume()
{
long volume(long l,int b,int h);
{
return(l*b*h);
}
}
void main()
{
set BOX b1;
b1.input();
b1.print();
b1.volume();
return;
}


Previous QuestionNext Question
What is electronic software?Tell me What is the difference between thread and process?