|
|
@ -2,6 +2,7 @@ |
|
|
|
#include <stdlib.h> |
|
|
|
#include <string.h> |
|
|
|
#include <ctype.h> |
|
|
|
#include <math.h> |
|
|
|
|
|
|
|
int main() { |
|
|
|
char line[100]; |
|
|
@ -14,7 +15,7 @@ int main() { |
|
|
|
break; |
|
|
|
} |
|
|
|
|
|
|
|
num1 = num2 = result = 0; |
|
|
|
num1 = num2 = result = expected_result = 0; |
|
|
|
op = '\0'; |
|
|
|
|
|
|
|
// Remove any spaces between symbols
|
|
|
@ -57,10 +58,18 @@ int main() { |
|
|
|
result = num1 * num2; |
|
|
|
break; |
|
|
|
case '/': |
|
|
|
if (num2 == 0) { |
|
|
|
printf("CHYBA\n"); |
|
|
|
continue; |
|
|
|
} |
|
|
|
result = num1 / num2; |
|
|
|
break; |
|
|
|
} |
|
|
|
|
|
|
|
// Round both result and expected_result to two decimal places
|
|
|
|
result = round(result * 100.0) / 100.0; |
|
|
|
expected_result = round(expected_result * 100.0) / 100.0; |
|
|
|
|
|
|
|
// Check if the result is correct
|
|
|
|
if (result == expected_result) { |
|
|
|
printf("OK\n"); |
|
|
|