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<stdlib.h> #include<stdio.h> #include<string.h> // // // int main(int argc, char** argv) { int m,n,i,j,k,flag,rank; char stulist[10001][31]; char name[31]; int mark[10001]; scanf("%d",&m); getchar(); for(i=0;i<m;i++) gets(stulist[i]); scanf("%d",&n); for(i=0;i<n;i++) { for(j=0;j<m;j++){ scanf("%d",&mark[j]); getchar(); gets(name); if(strcmp(name,"Li Ming")==0) flag=j; } rank=1; for(k=0;k<n;k++) if(mark[k]>mark[flag]) rank++; printf("%d\n",rank); } return (EXIT_SUCCESS); } 发现程序中只有一处未检查,就是如果输入成绩的时候的人名未在开始的名单中记录,程序不会报错,可是如果要检查这个的话,我该让程序退出还是怎么的? Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator