This commit is contained in:
Oleksandr Vyshniakov 2025-03-01 22:28:39 +01:00
parent 145f021165
commit cb46e866fe
2 changed files with 11 additions and 10 deletions

View File

@ -4,11 +4,11 @@
int main() {
char input[100];
if (fgets(input, sizeof(input), stdin) == NULL || input[0] == '\n') {
if (fgets(input, sizeof(input), stdin) != NULL && input[0] == '\n') {
return 0;
}
while (fgets(input, sizeof(input), stdin) != NULL && input[0] == '\n') {
double cislo1;
double cislo2;
@ -17,6 +17,11 @@ int main() {
char rovno;
int colznakov = sscanf(input, "%lf %c %lf %c %lf", &cislo1, &znak, &cislo2, &rovno, &result);
if (colznakov != 5 || rovno != '=') {
printf("CHYBA\n");
return 0;
}
double result2;
switch (znak)
@ -51,9 +56,5 @@ int main() {
printf("Zle\n");
}
}
return 0;
}
}

Binary file not shown.