samedi 31 janvier 2015

How to choose an object depending in three variables


Vote count:

0




Please, be patient with me otherwise i will be blocked. This is the problem to resolve; A woman needs to choose one of three man by his height and weight. This are the conditions to be the winner enter code here1. If his weight exceed 75kg get rejected enter code here2. Height should be closer to 180cm. enter code here3. If all of them exceed the 75kg, the winner is the one get closer to 255(sum of weight and height. For example; enter code here'179+77=256 this is the winner. enter code here'190+80=270 enter code here'160+90=250 enter code here4. And if all of them are the same, they will appear in enter code herealphabetical order.


**This is my code*



#include<conio.h>
#include<stdio.h>
typedef struct choose{
char name[20];
int height;
int weight;
}b;
int main(){
b man[3];
int i,in[3],e=0,suma[3];
for(i=0;i<3;i++){
printf("whats your name");
scanf("%s",man[i].name);
printf("whats your height");
scanf("%d",&man[i].height);
printf("whats your weight");
scanf("%d",&man[i].weight);
suma[i]=man[i].height+man[i].weight;
}
for(i=0;i<3;i++){
printf("%s,man[i].name");
printf("%d,man[i].height");
printf("%d,man[i].weight");
}
if (man[i].weight<=75){
in[e]==i;
e++;

}

getch();
return 0;
}


asked 27 secs ago







How to choose an object depending in three variables

Aucun commentaire:

Enregistrer un commentaire