Aktualizovat „du4/program.c“
This commit is contained in:
parent
e8448fbb67
commit
fb7c90bfb9
@ -47,6 +47,14 @@ double compare_percent(double a, double b, double eps)
|
||||
return diff < 0 ? -1 : diff > 0 ? +1 : 0;
|
||||
}
|
||||
|
||||
int check(char *str){
|
||||
for(int i =0;i<strlen(str);i++){
|
||||
if(str[i]=='='&&str[i+1]=='='){
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
int main()
|
||||
@ -59,12 +67,10 @@ int main()
|
||||
char *new_str = compactString(str[i],strlen(str[i]));
|
||||
double first =-5,second =-5,res=-5;
|
||||
char c='E';
|
||||
char ravno[3];
|
||||
ravno[1]='\n';
|
||||
sscanf(new_str,"%lf%c%lf%s%lf",&first,&c,&second,ravno,&res);
|
||||
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)||(ravno[1]!='\n'||ravno[0]!='=')){
|
||||
if(c!=43&&c!=42&&c!=45&&c!=47||check(new_str)==0){
|
||||
printf("CHYBA\n");
|
||||
continue;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user