Пример выполнения работы (структура боксер):
#
include <stdio.h>
#
include <conio.h>
#
include <iostream.h>
const
LEN = 40,LEN3=120;
struct
boxer {char fam[LEN] ,ima[LEN],otch[LEN];
unsigned rost,pobed,poragen;
float wes;
Void prn () const
{printf
("\n%s %s %s\n",fam,ima,otch);
printf ("wes %g\n",wes);
printf ("rost %d\n",rost);
printf ("wstrech %d\n",pobed+poragen);
printf ("pobed %d\n",pobed);
printf ("poragen %d\n",poragen);
}
int operator > (boxer a) const
{float
dolja1,dolja2;
dolja1=float(pobed)/(pobed + poragen);
dolja2=float(a.pobed)/(a.pobed + a.poragen);
return dolja1>dolja2;
}
};
Int main()
{textbackground(1);textcolor(14);
clrscr();
boxer a,b={"Deev","Ivan","Petrovich",183,11,1,77}
;
boxer * a1=&a,* b1=&b;
cputs ("fam = ");gets(a1->fam );
cputs ("ima = ");gets(a.ima );
cputs ("otch = ");gets(a.otch );
cputs ("wes = ");scanf("%f",&a.wes);
cputs ("rost = ");scanf("%d",&a.rost);
cputs ("pobed = ");scanf("%d",&a.pobed);
cputs ("poragen = ");scanf("%d",&a.poragen);
a1->prn();
b1->prn();
if (a>b) cout << a.fam << " effektivnee " <<
b1->fam;
else cout << b.fam << " effektivnee " <<
a1->fam;
getch();
return 0;
}