Witam,mam taki problem z kodem w C,że chcąc aby program przerywał pętlę po zasymulowaniu znaku EOF (Ctrl+z,bo windows),program go wgl nie uwzględnia.
Kiedy wpiszę -1 wszystko jest ok.O co chodzi? Czy to problem z formatowaniem %d ? Jak jest odbierany znak EOF przez system,skoro nie przez %d ?
Kod wygląda następująco:
while(1)
{
printf("Enter a number to convert it: ");
while((1!=scanf("%d",&number))&&(number!=EOF))
{
printf("\n\nUps!Something went wrong.Try again.\nEnter a number to convert it: ");
while(getchar()!='\n');
}
if (number==EOF) break;
printf("Enter a conversion system: ");
while(1!=scanf("%d",&system)|| (system<2 || system>10))
{
printf("\n\nUps!Something went wrong.Try again.\nEnter a conversion system: ");
while(getchar()!='\n');
}
convert(number,system);
}