This commit is contained in:
Andrii Hermaniuk 2022-03-27 16:02:15 +02:00
parent 3b60b325f1
commit 34e9eeb93d

View File

@ -22,8 +22,12 @@ int main(){
char *start=priklad, *end=NULL; char *start=priklad, *end=NULL;
for(int c=0;c<count;c++){ for(int c=0;c<count;c++){
int skip=0; int skip=0,znak=0;
for(int idx=0;start[idx]!='\n';idx++){ for(int idx=0;start[idx]!='\n';idx++){
if(start[idx]!='+'&&start[idx]!='-'&&start[idx]!='*'&&start[idx]!='/'){
znak=1;
}
if((start[idx]<'0'||start[idx]>'9')&&start[idx]!=' '&&start[idx]!='='&&start[idx]!='+'&&start[idx]!='-'&&start[idx]!='*'&&start[idx]!='/'&&start[idx]!='.'){ if((start[idx]<'0'||start[idx]>'9')&&start[idx]!=' '&&start[idx]!='='&&start[idx]!='+'&&start[idx]!='-'&&start[idx]!='*'&&start[idx]!='/'&&start[idx]!='.'){
skip=1; skip=1;
printf("CHYBA\n"); printf("CHYBA\n");
@ -32,7 +36,7 @@ for(int c=0;c<count;c++){
break; break;
} }
} }
if(skip==1){ if(skip==1||znk==0){
continue; continue;
} }
float num1=strtof(start,&end); float num1=strtof(start,&end);