jituTechnology

jituTechnology

>Write a program to calculate the volume converts each dimension from a distance variable to a variable of type float representing feet and fraction of a foot and then multiply the

>/*create a structure called volume that uses three variables of type distance to model the volume of room. Initialize a variable of type volume of room. Initialize a variable of type volume to specify dimensions, then calculate the volume it represents and printout the results. To calculate the volume converts each dimension from a distance variable to a variable of type float representing feet and fraction of a foot and then multiply the resulting three numbers

Programmed by:
Name: Jitendra Kr Yadav
Roll: 10116(NCIT-ELX)
Date: 15 July 2011*/
#include <iostream.h>
#include <conio.h>
struct Distance
{
int feet;
float inches;
};
struct room
{
Distance length;
Distance breadth;
Distance height;
};
int main()
{
room Study;
cout<<“Enter the length in feet and inches of the study room: “;
cin>>Study.length.feet>>Study.length.inches;
cout<<“Enter the breadth in feet and inches of the study room: “;
cin>>Study.breadth.feet>>Study.breadth.inches;
cout<<“Enter the height in feet and inches of the Study room: “;
cin>>Study.height.feet>>Study.height.inches;
float l=Study.length.feet+(Study.length.inches/12);
float b=Study.breadth.feet+(Study.breadth.inches/12);
float h=Study.height.feet+(Study.height.inches/12);
cout<<“The volume of Study Room is: ” <<l*b*h<<” cubic feet”;
getch();
return 0;
}
Output Sample:
Enter the length in feet and inches of the study room: 5
6
Enter the breadth in feet and inches of the study room: 7
8
Enter the height in feet and inches of the study room: 9
11
The volume of the study Room is: 418.153 cubic feet

No comments yet.

Add a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.



Connect with Me

GPO 8973 NPC 541; Kathmandu Nepal
Phone: +977 9851236800

Calendar

March 2024
S M T W T F S
 12
3456789
10111213141516
17181920212223
24252627282930
31