-1
Good evening guys I’m here with a problem that automatically my value is read on IS() anyone know why this is happening? can’t find the error.
if((con1 != 0) && (con2 != 0) && (con3 != 0) && (con4 != 0) && (con5 != 0))
{
printf("\n---------------------------------------------------------");
printf("\nJa usou todas as opçoes quer continuar ? : ");
scanf("%c", &opt);
if((opt == 's'))
{
system("cls");
}
else if((opt == 'n'))
{
return 0;
}
else{
printf("\nErro, introdusa outra vez : ");
scanf("%c", &opt);
}
}
You can’t say for sure with just this snippet of code but, apparently, that’s the old problem with the dirty input buffer. Make sure there are no characters in the input buffer before your scanf.See ietm 12.26b of http://www.faqs.org/faqs/C-faq/faq/
– anonimo
I basically have to use this code?
– Dimas Hutsulyak
while((c = getchar()) != ' n' && c != EOF) /* discard */ ;
– Dimas Hutsulyak