I was practicing a bit of c to refresh my memory and there are some lines that are not working for me:
int main(){
char nombre[20];
int cont = 3;
printf("Ingresa tu nombre de usuario\n");
fgets(nombre,20,stdin);
fflush(stdin);
while(strcmp(nombre,"jorge")!=0){
printf("Nombre de usuario incorrecto, ingrese nuevamente (Intentos restantes: %i)\n",cont);
fgets(nombre,20,stdin);
fflush(stdin);
cont--;
}
if(cont==0) {
printf("Se acabaron los intentos, vuelva mas tarde\n");
exit(1);
}
printf("El programa continua normalmente\n");
}
Even though I put the valid name (jorge) it still enters the loop and I do not understand why