Question #20757

Create a structure called volume that uses three variables (length, width, height ) of type distance (feet and inches) to model the volume of a room. Read the three dimensions of the room and calculate the volume it represents , and print out the result. The volume should be in cu. feet form, i.e., you will have to convert each dimension in to feet and fractions of foot. For instance , the length 12 feet 6 inches will be 12.5 feet.

Expert's answer

#include <iostream>

#include <stdlib.h>

using namespace std;

int main()

{

cout<<"please enter a1 and a2"<<endl;

double a1,a2;

cin>>a1;

cout<<"& quot;;

cin>>a2;

cout<<endl;

cout<<"please enter b1 and b2"<<endl;

double b1,b2;

cin>>b1;

cout<<"& quot;;

cin>>b2;

cout<<endl;

cout<<"please enter c1 and c2"<<endl;

double c1,c2;

cin>>c1;

cout<<"& quot;;

cin>>c2;

cout<<endl;

double a,b,c;

& a=a1+a2/12;

& b=b1+b2/12;

& c=c1+c2/12;

cout<<"a="<<a<<"& b="<<b<<"& c="<<c<<endl;

double V=0;

V=a*b*c;

cout<<"V="<<V<<"& (feet^3)";

& system("PAUSE");

& return 0;

}

#include <stdlib.h>

using namespace std;

int main()

{

cout<<"please enter a1 and a2"<<endl;

double a1,a2;

cin>>a1;

cout<<"& quot;;

cin>>a2;

cout<<endl;

cout<<"please enter b1 and b2"<<endl;

double b1,b2;

cin>>b1;

cout<<"& quot;;

cin>>b2;

cout<<endl;

cout<<"please enter c1 and c2"<<endl;

double c1,c2;

cin>>c1;

cout<<"& quot;;

cin>>c2;

cout<<endl;

double a,b,c;

& a=a1+a2/12;

& b=b1+b2/12;

& c=c1+c2/12;

cout<<"a="<<a<<"& b="<<b<<"& c="<<c<<endl;

double V=0;

V=a*b*c;

cout<<"V="<<V<<"& (feet^3)";

& system("PAUSE");

& return 0;

}

## Comments

## Leave a comment