Aktualizovat „du4/program.c“
This commit is contained in:
parent
633c772c61
commit
f8cd7b9890
@ -6,10 +6,11 @@ int main(){
|
|||||||
int num1, num2, answer;
|
int num1, num2, answer;
|
||||||
char action;
|
char action;
|
||||||
sscanf(read, "%d %c %d %*c %d", &num1, &action, &num2, &answer);
|
sscanf(read, "%d %c %d %*c %d", &num1, &action, &num2, &answer);
|
||||||
if(action != '/' || action != '*' || action != '-' ||action != '+'){
|
if(action != '/' && action != '*' && action != '-' && action != '+'){
|
||||||
printf("CHYBA\n");
|
printf("CHYBA\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
int check = (action == '/') ? num1 / num2 : (action == '*') ? num1 * num2 : (action == '+') ? num1 + num2 : num1 - num2;
|
int check = (action == '/') ? num1 / num2 : (action == '*') ? num1 * num2 : (action == '+') ? num1 + num2 : num1 - num2;
|
||||||
printf("%s\n", (check == answer) ? "OK" : "ZLE");
|
printf("%s\n", (check == answer) ? "OK" : "ZLE");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user