Answer to Question #265557 in C++ for Usama

Question #265557

Create a structure called volume that uses three variables of type Distance (structure) to model the volume of a room. Initialize a variable of type volume to specific dimensions, and then calculate the volume it represents and print out the result.


1
Expert's answer
2021-11-20T09:49:29-0500
#include<iostream>
#include<conio.h>
using namespace std;
struct volume
{
 int length,width,height,l_inch,w_inch,h_inch;
};
int main()
{
 volume v;
 cout<<"Enter feet then inches"<<endl;
 cout<<"Enter the length of room  (feet and inches) : ";
 cin>>v.length>>v.l_inch;
 cout<<"Enter the width of room (feet and inches) : ";
 cin>>v.width>>v.w_inch;
 cout<<"Enter the Height of room (feet and inches) : ";
 cin>>v.height>>v.h_inch;
 
 float length,width,height,volume;
 length=v.length+((float)(v.l_inch)/12);
 width=v.width+((float)(v.w_inch)/12);
 height=v.height+((float)(v.h_inch)/12);
 cout<<"The length of room in foot is : "<<length<<endl;
 cout<<"The Base of room in feet is: "<<width<<endl;
 cout<<"The Height of room in feet is : "<<height<<endl;
 volume=length*width*height;
 cout<<"Volume of Room is: "<<volume;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS