Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <stdio.h>
- using namespace std;
- typedef struct Distance
- {
- int feet;
- int inches;
- }Distance;
- struct volume
- {
- Distance length;
- Distance width;
- Distance heigth;
- };
- void main()
- {
- volume room;
- cout << "Insert the length: " << endl;
- cout << "Feet: ";
- cin >> room.length.feet;
- cout << "Inches: ";
- cin >> room.length.inches;
- cout << endl << "Insert the width: " << endl;
- cout << "Feet: ";
- cin >> room.width.feet;
- cout << "Inches: ";
- cin >> room.width.inches;
- cout << endl << "Insert the heigth: " << endl;
- cout << "Feet: ";
- cin >> room.heigth.feet;
- cout << "Inches: ";
- cin >> room.heigth.inches;
- float l,w,h,v;
- l = room.length.feet + (float)room.length.inches/12;
- w = room.width.feet + (float)room.width.inches/12;
- h = room.heigth.feet + (float)room.heigth.inches/12;
- v = l*w*h;
- cout << endl << endl << "Volume of the room: " << v << " feet." << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment