Struct: corredor, categoria

estructura corredor.html
#include <stdio.h>

struct corredor{
	char nombre[30];
	int edad;
	char sexo[10];
	char club[30];
}corredor1;

int main(){
	printf("Ingrese nombre: ");
	gets(corredor1.nombre);
	printf("Ingrese edad: ");
	scanf("%d",&corredor1.edad);
	fflush(stdin);
	printf("Ingrese sexo: ");
	gets(corredor1.sexo);
	printf("Ingrese club: ");
	gets(corredor1.club);
	
	printf("El nombre es: %s \n",corredor1.nombre);
	printf("La edad es: %d \n",corredor1.edad);
	printf("El sexo es: %s \n",corredor1.sexo);
	printf("El club es: %s \n",corredor1.club);
	
	if(corredor1.edad<=18){
		printf("Categoria juvenil\n");
	}
	else if(corredor1.edad> 18 && corredor1.edad <=40){
		printf("Categoria senor\n");
	}
	else{
		printf("Categoria veterano\n");
	}
	
	
	
	system("pause");
	return 0;
}

No hay comentarios:

Publicar un comentario