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.
Answers were Sorted based on User's Feedback
Answer / muhammad waqas
#include<iostream>
using namespace std;
class Box{
public:
int height;
int length;
int width;
};
main()
{
int height;
int length;
int width;
int volume=0;
Box box1;
Box box2;
box1.height=3;
box1.length=2;
box1.width=1;
volume=box1.height*box1.length*box1.width;
cout<<volume;
}
Is This Answer Correct ? | 88 Yes | 40 No |
Answer / manish bhambhu
#include<iostream>
using namespace std;
class cuboid
{
public:
float length;
float breadth;
float height;
};
int main()
{
cuboid Box1;
cuboid Box2;
float volume = 0.0;
Box1.height = 5.0;
Box1.length = 6.0;
Box1.breadth = 7.0;
Box2.height = 10.0;
Box2.length = 12.0;
Box2.breadth = 13.0;
volume=Box1.height*Box1.length*Box1.breadth;
cout<<"
Volume of Box1 : "<<volume<<endl;
volume=Box2.height*Box2.length*Box2.breadth;
cout<<"
Volume of Box2 : "<<volume<<endl;
return 0;
}
Is This Answer Correct ? | 0 Yes | 2 No |
Answer / prakruthi
#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;
}
Is This Answer Correct ? | 38 Yes | 58 No |
sir please send me bpcl previous question papers
0 Answers BPCL Bharat Petroleum,
if x<>=z then statement end what is the cyclomatic complexity
Difference between Structure and Class in C++?
Explain how to insert a hyperlink in to an Excel worksheet and save a Word document as a Web page.
What is the use of stl?
how to overload << and >> operator in c++
What is Constructor
Write a program in C++ to concatenate two strings into third string using pointers
a program using one dimensional array that searches a number if it is found on the list of given input numbers given by the user and locate its exact location in the list.
write a program to search and display the position of an element in a single-dimentional array using function.
Is there any error below, its a code to delete all entires from a map #include <map> #include iostream.h int main() { int i =0; map <int, char> TestMap; while(i<3) { TesMap.insert(TestMap::value_type(i,Test)); i++; } typedef map<int, char> :: iterator mapIter =TestMap.begin(); if(mapIter!=TestMap.end()) { TestMap.erase(mapItrer); ++mapIter; } return 0; }
what is c++