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 |
牛人们看看我的程序,为什么WA?!#include<stdio.h> #include<string.h> void main() { char U[100][10],V[100][30]; double A[100],R[100],P[100]; int i=0,j=0,top,flag=0,lack[100]={0}; while(1) { scanf("%lf %s %lf\n",&A[i],U[i],&R[i]); gets(V[i]); if (A[i]<0) break; j=strlen(V[i]);//实在找不到原因我就加了这个,可还不行 if (V[i][j-1]==' ') V[i][j-1]='\0'; P[i]=A[i]/R[i]*100; i++; } top=i-1; j=0; for(i=0;i<=top;i++) { if (P[i]>=1) { printf("%s %.1lf %s %.0lf",V[i],A[i],U[i],P[i]); putchar('%'); putchar('\n'); } else { lack[j]=i; j++; flag=1; } } if (flag) { printf("Provides no significant amount of:\n"); for(i=0;lack[i]!=0;i++) { printf("%s\n",V[lack[i]]); } } } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator