/****************************************************************************** Online C Compiler. Code, Compile, Run and Debug C program online. Write your code in this editor and press "Run" button to compile and execute it. *******************************************************************************/ #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]; memset(str,0,100); fgets(str,100,stdin); char *new_str = compactString(str,strlen(str)); double first =-5,second =-5,res=-5; char c='E'; sscanf(new_str,"%lf%c%lf%*[=]%lf",&first,&c,&second,&res); if(c=='E'||first==-5||second==-5||res==-5||c!=43||c!=42||c!=45||c!=47){ printf("CHYBA\n"); return 0; } 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; }