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 |
不知道为什么就是出错?帮忙给看看#include <iostream.h> void main() { int i,e,d,f,x,o,m,n,t,h1; char a[200],b[200],c[9],z[200]; cin.getline(c,10,'\n'); for (i=0;i<200;i++) { a[i]='@'; b[i]='@'; } e=0; i=5; f=-1; while(c[i]!='.') { if(c[i]!='0'||f==0) {e++;f=0;} else {e=0;} i--; } i=0; d=0; while(c[i]!='.'&&i<6) { d++; i++; } d=d+e; x=0; for(i=1;i<=d;i++) { if(c[d-i+1]!='.') {a[i-x]=c[d-i+1]; b[i-x]=c[d-i+1];} else {x=1;} } if(c[d-i+1]!='.') {a[i-x]=c[d-i+1]; b[i-x]=c[d-i+1];} if(c[7]!=' ') o=(c[7]-48)*10+c[8]-48; else o=c[8]-48; if(o>=25) o=25; else if(o<1) o=1; m=0; n=0; if(o==1) { for(n=0;n<200;n++) z[n]=a[n]; } n=199; while (a[n]=='@') {z[n]='0';a[n]='0';n--;} h1=d; for(i=0;i<o-1;i++) { for(n=0;n<200;n++) { z[n]='0'; } n=0; m=0; for(f=1;f<=d;f++) { for(x=1;x<=h1;x++) { t=(a[x]-48)*(b[f]-48)+z[m+n+1]-48; z[m+n+1]=t%10+48; z[m+n+2]=z[m+n+2]+t/10; m++; } m=0; n++; } n=0; for(n=0;n<200;n++) a[n]=z[n]; n=1; while(a[200-n]!='0') n++; h1=200-n; } e=e*o; n=1; while(a[200-n]=='0') n++; d=200-n; if(d>=1) { for(i=0;i<d-e;i++) {cout<<a[d-i];} } if(e!=0) cout<<"."; if(e!=0) { for(i=0;i<e;i++) cout<<a[e-i]; } cout<<endl; } 考虑过1.0000 1 10.000 1 0.1 1 Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator