Update 'du4/program.c'
This commit is contained in:
parent
bfc52924ce
commit
31ca326c6b
@ -47,7 +47,7 @@ int main() {
|
|||||||
|
|
||||||
if (valid) {
|
if (valid) {
|
||||||
// Evaluate expression
|
// Evaluate expression
|
||||||
float result;
|
float result = 0;
|
||||||
switch (op) {
|
switch (op) {
|
||||||
case '+':
|
case '+':
|
||||||
result = num1 + num2;
|
result = num1 + num2;
|
||||||
@ -64,14 +64,14 @@ int main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
expected = round(expected * 100) / 100;
|
result = round(result * 100) / 100;
|
||||||
if (fabs(result - expected) < 0.001) {
|
if (num2(result - result) < 0.001) {
|
||||||
printf("OK\n");
|
printf("OK\n");
|
||||||
} else {
|
} else {
|
||||||
printf("ZLE\n");
|
printf("ZLE\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user