#include #include #include #include char* compactString(char *src,int leng) { char *new_str = (char*)calloc(leng+1,sizeof(char)); int k=0; for(int i=0;i 0 ? +1 : 0; } int main() { char str[100][100]; for(int i =0;fgets(str[i],100,stdin);i++){ if(str[i][0]=='\n'){ break; } char *new_str = compactString(str[i],strlen(str[i])); double first =-5,second =-5,res=-5; char c='E'; char ravno[3]; sscanf(new_str,"%lf%c%lf%s%lf",&first,&c,&second,ravno,&res); if(c=='E'||first==-5||second==-5||res==-5||(c!=43&&c!=42&&c!=45&&c!=47||(strlen(ravno)==1&&ravno[0]=='='))){ printf("CHYBA\n"); continue; } double my_res = operation(first,second,c); if(compare_percent(res,my_res,0.01)==0){ printf("OK\n"); } else{ printf("ZLE\n"); } } return 0; }