2020-03-31 10:25:27 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <ctype.h>
|
|
|
|
|
|
|
|
int call(double A, double B, double C, char AC){
|
|
|
|
if(AC=='/'&&B==0){
|
|
|
|
return printf("CHYBA");;
|
|
|
|
}
|
2020-03-31 11:02:27 +00:00
|
|
|
else if(AC=='+'){
|
2020-03-31 10:25:27 +00:00
|
|
|
if(A+B==C)return printf("OK");
|
|
|
|
return printf("ZLE");
|
|
|
|
}
|
2020-03-31 11:02:27 +00:00
|
|
|
else if(AC=='-'){
|
2020-03-31 10:25:27 +00:00
|
|
|
if(A-B==C)return printf("OK");
|
|
|
|
return printf("ZLE");
|
|
|
|
}
|
2020-03-31 11:02:27 +00:00
|
|
|
else if(AC=='*'){
|
2020-03-31 10:25:27 +00:00
|
|
|
if(A*B==C)return printf("OK");
|
|
|
|
return printf("ZLE");
|
|
|
|
}
|
2020-03-31 11:02:27 +00:00
|
|
|
else if(AC=='/'){
|
2020-03-31 10:25:27 +00:00
|
|
|
if(A/B==C)return printf("OK");
|
|
|
|
return printf("ZLE");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
int main()
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
char *str;
|
|
|
|
str=(char*)malloc(100);
|
2020-03-31 11:02:27 +00:00
|
|
|
double a,b,c;
|
|
|
|
char ac,el;
|
|
|
|
int ind=0;
|
|
|
|
for(int i=0;el!='\n';i++){
|
|
|
|
el=getchar();
|
|
|
|
if(isspace(el)){
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
str[ind]=el;
|
|
|
|
ind++;
|
|
|
|
}
|
|
|
|
//scanf("%s",str);
|
|
|
|
sscanf(str,"%lf%c%lf=%lf ",&a,&ac,&b,&c);
|
|
|
|
//printf("%f %d %f =%f",a,ac,b,c);
|
2020-03-31 10:25:27 +00:00
|
|
|
call(a,b,c,ac);
|
|
|
|
return 0;
|
2020-03-31 11:02:27 +00:00
|
|
|
}
|