Программа выводит большую длину из двух исходных.
В английской системе мер.
//------------------------------------------------------------------------------------------------
#include <iostream>
#include <conio.h>
using namespace std;
struct Distance //Структура
{
int feet;
float inch;
};
Distance cool(Distance, Distance);
int main()
{
Distance first={5, 8.6};
Distance second={4, 4.8};
cout<<"First dlina: "<<first.feet<<' '<<first.inch<<endl;
cout<<"Second dlina: "<<second.feet<<' '<<second.inch<<endl<<endl;
Distance therd;
therd=cool(first, second);
cout<<"Bolwaya dlina: "<<therd.feet<<"FUTOV
"<<therd.inch<<"DUMOV"<<endl;
getch();
return 0;
}
Distance cool(Distance d1, Distance d2)
{
float a=d1.feet+d1.inch/12;
float b=d2.feet+d2.inch/12;
if(a>b)
return d1;
else
return d2;
}
//------------------------------------------------------------------------------------------------