Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
怎么输入n组数据并判定输入结束(C)???? 如果单是求一个浮点数的N次方,我的程序绝对问题(fun部分)。UNIX上调试过了,无误。 void fun(float a,int n) { long al,temp1,temp2; short b[150]={0}; int i,j,k=0; short *p;p=b; while(a!=(float)((int)a)) {a*=10;k++; } k=k*n; al=(int)a; b[149]=1; for(i=0;i<n;i++) { temp2=0; for(j=149;j>=0;j--) { temp1=b[j]*al+temp2; b[j]=temp1%10; temp2=temp1/10; } } while(*p==0&&p<149-k) p++; for(;p<b+150-k;p++) printf("%d",*p); printf("."); for(;p<b+150;p++) printf("%d",*p); } main() {???? Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator