Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

怎麽只输入"END"啊?

Posted by Sunhongjian at 2010-11-27 12:38:38 on Problem 2218
#include<stdio.h>
#include<string.h>
struct student
{
	char name[10];
	int date;
	int Sweight;
	int num[100];
}stu[100];
int main()
{

	int i=0,l,max,p,k=0;
	char c[10];
	char a[10]="END";
	

	scanf("%s",c);	
	scanf("%s %d %d",stu[i].name,&stu[i].date,&stu[i].Sweight);
		while(strcmp(stu[i].name,a)!=0)
		{
			stu[i].num[i]=stu[i].Sweight-stu[i].date;
			i++;
			scanf("%s%d%d",stu[i].name,&stu[i].date,&stu[i].Sweight);

		}
		while(k<i)
		{
			p=0;
			max=stu[0].num[0];
			for(l=0;l<i;l++)
		{	
		
			if(stu[l].num[l]>max)
			{max=stu[l].num[l];
			p=l;}
		}
		printf("%s\n",stu[p].name);
		stu[p].num[p]=-999;
		k++;
		}
}

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator