This commit is contained in:
Ivan Leichenko 2024-10-14 15:42:05 +02:00
parent e05fd36e76
commit 44d1e60eb3

View File

@ -81,11 +81,15 @@ int main(int argc, char const *argv[])
{ {
break; break;
} }
if(isalpha(buf) != 0) for (int i = 0; i < strcspn(buf, "\n"); i++)
{ {
printf("bad input\n"); if(isalpha(buf[i]) != 0)
return 0; {
printf("bad input\n");
return 0;
}
} }
buf[strcspn(buf, "\n")] = '\0'; buf[strcspn(buf, "\n")] = '\0';
if(!check_op(buf[0])) if(!check_op(buf[0]))
{ {