Aktualizovat „du4/program.c“

This commit is contained in:
Pavlo Tverdyi 2020-04-02 19:03:18 +00:00
parent 08f883d31b
commit 2a776ae59b

View File

@ -41,11 +41,15 @@ int count=0;
int eof;
for(;eof!=EOF;count++){
eof=0;
int k=0;
str=(char*)malloc(100);
int ind=0;
for(int i=0;eof!='\n';i++){
eof=getchar();
if(eof==EOF) break;
if(!isdigit(eof) && eof!='.' && eof!=' '){
k++;
}
if(eof!=' '){
str[ind]=eof;
ind++;
@ -53,6 +57,11 @@ for(;eof!=EOF;count++){
}
if(eof==EOF) break;
sscanf(str,"%lF%c%lF=%lF ",&a,&ac,&b,&c);
free(str);
if(k>3){
result[count]=3;
continue;
}
switch(ac){
case '+':
add(a,b,c,ac,result,count);
@ -67,9 +76,8 @@ for(;eof!=EOF;count++){
divi(a,b,c,ac,result,count);
break;
default:
result[count]=3;
result[count]=3;
}
free(str);
}
count--;
for(int j=0;j<count;j++){