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.
Answer Posted / 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 |
Post New Answer View All Answers
Can we use stl in coding interviews?
How do I convert a stl file?
Describe how to safeguard a system through acquisition of an antivirus Program and systematic backup.
What are the components of stl?
What do stl stand for?
What are the symptoms of stl?
What two types of containers does the stl provide?
If P is the population on the first day of the year, B is the birth rate, and D is the death rate, the estimated population at the end of the year is given by the formula: The population growth rate is given by the formula: B – D Write a program that prompts the user to enter the starting population, birth and death rates, and n, the number of years. The program should then calculate and print the estimated population after n years. Your program must have at least the following functions: 1. growthRate: This function takes its parameters the birth and death rates, and it returns the population growth rate. 2. estimatedPopulation: This function takes its parameters the current population, population growth rate, and n, the number of years. It returns the estimated population after n years Your program should not accept a negative birth rate, negative death rate, or a population less than 2. please answer my question ....
What is meant by stl in c++?
What is stl stand for?
how can u do connectivity in c++ language? plz send me connectivity code in c++ ?
Is stl open source?
What is stl stack?
Define stl.
What does stl mean in slang?