001
jiimoo吧
全部回复
仅看楼主
level 6
jiimoo 楼主
dsfa
2006年07月21日 16点07分 1
level 6
jiimoo 楼主
ok(char st[],double y){double x=1.0;int n;for(n=0;n<20;n++){if(y-x<0) break;x*=10;}}
2006年07月21日 16点07分 2
level 6
jiimoo 楼主
ok(char st[],double y){double x=1.0;int n,i;for(n=0;n<20;n++){if(y-x<0) break;x*=10;}x/=10;for(i=1;;i++){y-=x;if(y
2006年07月21日 16点07分 3
level 6
jiimoo 楼主
ok(char st[],double y){double x=1.0;int n,i;for(n=0;n<20;n++){if(y-x<0) break;x*=10;}x/=10;for(n=0;x>0;n++){for(i=0;y
0;n++){for(i=0;y
2006年07月21日 17点07分 4
level 6
jiimoo 楼主
ok(char st[],double y){double x=1.0;int n,i;for(n=0;n<20;n++){if(y-x<0) break;x*=10;}x/=10;for(n=0;x>0;n++){for(i=0;y
50;n++){for(i=0;y
2006年07月21日 17点07分 5
level 6
jiimoo 楼主
main(){char st[50];double y=244.244;ok(st,y);printf("%s , ",st);}ok(char st[],double y){double x=1.0;int n,i;for(n=0;n<20;n++){if(y-x<0) break;x*=10;}x/=10;for(n=0;x>0;n++){for(i=0;y
10;n++){for(i=0;y
2006年07月21日 17点07分 6
level 6
jiimoo 楼主
main(){char st[50]="123";double y=244.244;double x=1.0;int n,i;for(n=0;n<20;n++){if(y-x<0) break;x*=10;}x/=10;printf("%lf\n",x); /*x=100*/for(n=0;x>0;n++){for(i=0;y
2006年07月21日 17点07分 7
level 6
jiimoo 楼主
main(){char st[10]="0000000";double y=244.244;double x=1.0;int n,i;for(n=0;n<20;n++){if(y-x<0) break;x*=10;}x/=10;printf("%lf\n",x); /*x=100*/for(n=0;x>0;n++){for(i=0;y>=x;i++) y-=x;st[n]=i+48;if(y<1) break;x/=10;}printf("y is :%lf\n",y);printf("st is %s\n",st);printf("x is %lf\n",x);}
2006年07月21日 18点07分 8
level 6
jiimoo 楼主
main(){char st[10]="0000000";double y=244.244;double x=1.0;int n,i;for(n=0;n<20;n++){if(y-x<0) break;x*=10;}x/=10;printf("%lf\n",x); /*x=100*/for(n=0;y>=1;n++){for(i=0;y>=x;i++) y-=x;st[n]=i+48;x/=10;}printf("y is :%lf\n",y);printf("st is %s\n",st);printf("x is %lf\n",x);}
2006年07月21日 18点07分 9
level 0
#include
main(){char st[100]={'0',''}; /*记录用户输入的内容*/char st0[50]={'0',''}; /*临时所用的字符串 */char st1[1]={'0'}; /*临时所用的字符串 */double d[20]; /* 储存数据的数组 */char ss[20]={''}; /*储存符号的字符串 */int dn=0; /*记录数组的有效个数*/double swanp5();/*临时所用到的变量*/char *p;char c;int n,i,j,k;double x,y,x1,x2;/*临时所用到的变量*/while(1){/*--记录用户的输入---------------*/p=st;while( (c=getchar())!='\n' ){*p=c;p++;}*p='\0';/*--测试输入是否记录下来----------*/if(st[0]=='+'||st[0]=='-'||st[0]=='*'||st[0]=='/')swanp11(st0,st);/*----------求d[] ,ss[] 开始-------*/while(1){/*得到第一个数据*/*st0='0'; /*st=1.2
+3
.4+5.6*/swanp1(st0,st);/*st0=1.2*/x=swanp5(st0);/*x=1.2*/d[dn]=x;dn++;/*d=1.2, dn=1*//*得到第一个数据*//*得到第一个符号*/*st1='0';swanp2(st,st1); /*st1='+'*/c=*st1; /*c='+'*/if( c=='0') break;swanp3(ss,c); /*ss='+', */ /*st=1.2+3.4+5.6*//*得到第一个符号*//*初始化输入*/i=swanp4(st0);for(n=0;n<=i;n++)swanp9(st,0);/*初始化输入*/}/*----------求d[] ,ss[]完毕---------*//*---计算两组据运算结果 y 开始-----*/while(1){/*运算一次*/p=ss;i=swanp8(ss);if(i==-1) break;c=*(p+i);x1=d[i];x2=d[i+1];k=1;switch(c){case '+':y=x1+x2;break;case '-':y=x1-x2;break;case '*':y=x1*x2;break;case '/':y=x1/x2;break;default:k=0;break;} /*运算一次*//*初始化 */swanp6(d,i,dn);dn--;swanp7(d,i,y);swanp9(ss,i);/*初始化 */}/*--------计算两组据运算结果 y 完毕----*//*打印结果,并初始化变量以待下次计算使用*/printf("%lf\n",y);dn--;swanp10(st0,y);/*打印结果,并初始化变量以待下次计算使用*/}}/*九个方法*/swanp1(char st0[],char st[]){int n=0;char *p0=st0;char *p=st;p++;while(1){if( (*p)=='+'||(*p)=='-'||(*p)=='*'||(*p)=='/'||(*p)=='\0') break;p++;}while( (st+n)
=1.0;n++){for(i=0;y>=x;i++) y-=x;st[n]=i+48;x/=10;} /*x=0.1,y=0.24,st=244*/st[n++]='.'; /*x=0.1,y=0.24,st=244.000,n=4*/for(k=0;k<15;k++){for(i=0;y>=x;y-=x,i++);st[n++]=i+48;x/=10;}st[n]='\0'; /* k 记录精确度*/if(sb==1) swanp11("-",st);}swanp11(char st0[],char st[]){char st1[150];char *p1=st0;char *p2=st;char *p3=st1;while(*p3=*p1) {if(*p3=='\0')break;p3++;p1++;}while(*p3=*p2) {if(*p3=='\0')break;p3++;p2++;}p2=st;p3=st1;while(*p2++=*p3++);}
2006年07月21日 21点07分 10
1