#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <stdbool.h>
#include <string.h>
typedef struct jogador
{
char nome[30];
int idade;
int chutes;
int gols;
}Jogador;
int main()
{
Jogador j1, j2;
int r1, r2;
gets(j1.nome);
scanf("%d", &j1.idade);
scanf("%d", &j1.chutes);
scanf("%d", &j1.gols);
printf("Jogador 1 Terminou");
gets(j2.nome);
scanf("%d", &j2.idade);
scanf("%d", &j2.chutes);
scanf("%d", &j2.gols);
printf("Jogador 2 Terminou");
r1 = (j1.gols * 100)/j1.chutes;
r2 = (j2.gols * 100)/j2.chutes;
if(r1 > r2)
{
printf("%s (%d)", j1.nome, j1.idade);
}
else printf("%s (%d)", j2.nome, j2.idade);
printf("Fim de Programa");
}
After the second gets (gets(j2.nome);) read, my program does not scan the others values and just stop. Ive, tried using fgets but end up with the same problem.
If any one could help i appreciate.