Aktualizovat „du4/program.c“
This commit is contained in:
parent
08b68b2eab
commit
c4d540bae0
@ -12,17 +12,17 @@ void add(double a, double b, double c,char ac, int result[],int count){
|
|||||||
else result[count]=2;
|
else result[count]=2;
|
||||||
}
|
}
|
||||||
|
|
||||||
double subtr(double a, double b, double c,char ac, int result[],int count){
|
void subtr(double a, double b, double c,char ac, int result[],int count){
|
||||||
if(a-b==c) result[count]=1;
|
if(a-b==c) result[count]=1;
|
||||||
else result[count]=2;
|
else result[count]=2;
|
||||||
}
|
}
|
||||||
|
|
||||||
double multi(double a, double b, double c,char ac, int result[],int count){
|
void multi(double a, double b, double c,char ac, int result[],int count){
|
||||||
if(a*b==c) result[count]=1;
|
if(a*b==c) result[count]=1;
|
||||||
else result[count]=2;
|
else result[count]=2;
|
||||||
}
|
}
|
||||||
|
|
||||||
double divi(double a, double b, double c,char ac, int result[],int count){
|
void divi(double a, double b, double c,char ac, int result[],int count){
|
||||||
float cc=a/b;
|
float cc=a/b;
|
||||||
double Cc=(int)((a/b)*100000);
|
double Cc=(int)((a/b)*100000);
|
||||||
if(Cc==c || a/b==c || cc==(int)(c*100000)) result[count]=1;
|
if(Cc==c || a/b==c || cc==(int)(c*100000)) result[count]=1;
|
||||||
@ -40,15 +40,16 @@ char ac,el=0;
|
|||||||
int count=0;
|
int count=0;
|
||||||
int eof;
|
int eof;
|
||||||
for(;eof!=EOF;count++){
|
for(;eof!=EOF;count++){
|
||||||
str=(char*)malloc(20);
|
eof=0;
|
||||||
eof=scanf("%s",str);
|
str=(char*)malloc(100);
|
||||||
int ind=0;
|
int ind=0;
|
||||||
for(int i=0;i<strlen(str);i++){
|
for(int i=0;eof!='\n';i++){
|
||||||
if(isspace(str[i])){
|
eof=getchar();
|
||||||
continue;
|
if(eof==EOF) break;
|
||||||
|
if(eof!=' '){
|
||||||
|
str[ind]=eof;
|
||||||
|
ind++;
|
||||||
}
|
}
|
||||||
str[ind]=str[i];
|
|
||||||
ind++;
|
|
||||||
}
|
}
|
||||||
sscanf(str,"%lF%c%lF=%lF ",&a,&ac,&b,&c);
|
sscanf(str,"%lF%c%lF=%lF ",&a,&ac,&b,&c);
|
||||||
switch(ac){
|
switch(ac){
|
||||||
@ -77,9 +78,4 @@ for(;eof!=EOF;count++){
|
|||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user