Программа производит подсчет объема комнаты
с использованием структур.

//------------------------------------------------------------------------------------------------
#include <iostream>
#include <conio.h>
using namespace std;

struct Distance
{ int feet;
float inch;
};

struct Volume
{ Distance lenth;
Distance width;
Distance hight;
};
////////////////////////
int main ()
{
char cool='a';
while(cool!='n')
{
cout<<endl;
char ch=',';
Volume room;
cout<<"Enter the lenth room (feet,inch): ";
cin>>room.lenth.feet>>ch>>room.lenth.inch;
cout<<"Enter the width room (feet,inch): ";
cin>>room.width.feet>>ch>>room.width.inch;
cout<<"Enter the hight room (feet,inch): ";
cin>>room.hight.feet>>ch>>room.hight.inch;
float l=room.lenth.feet+room.lenth.inch/12;
float w=room.width.feet+room.width.inch/12;
float h=room.hight.feet+room.hight.inch/12;
cout<<"Volumeis: "<<l*w*h<<endl;
cout<<"Continue? (y/n): ";
cool=getche();
}
cout<<"Goodbay";
return 0;
}

//------------------------------------------------------------------------------------------------

Хакинг | Главная | Программирование

Hosted by uCoz