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


Please Help Members By Posting Answers For Below Questions

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.

1583


Is stl part of c++ standard?

816


write a program that will accept a number and print.its equivalent in words the maximum input number is 9999

2695


Who created stl?

861


draw a flowchart that accepts two numbers and checks if the first is divisible by the second.

3087


Write a C/C++ program that connects to a MySQL server and checks if the InnoDB plug-in is installed on it. If so, your program should print the total number of disk writes by MySQL.

2174


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 ....

2023


What is a list in c++ stl?

879


What is the stl, standard template library?

818


Who wrote stl?

883


What does stl mean in slang?

833


When did c++ add stl?

935


What two types of containers does the stl provide?

749


What are the symptoms of stl?

815


i wanted to know about questions about c,c++ , which is required for placements.... im a fresher

1914