poj1236

结构体排序~水过
#include 
#include 
#include 
using namespace std;
struct node
{
	char name[21];
	int all_score;
}c[1005];
bool cmp(node x,node y)
{
	if(x.all_score>y.all_score) return true;
	if(x.all_score==y.all_score&&strcmp(x.name,y.name)<0) return true;
	return false;
}
int main()
{
	int peo,test,per,sum,x,score[11],n,q;
	char name_peo[21];
	while(scanf("%d",&peo)&&peo)
	{
		scanf("%d %d",&test,&per);
		for(int i=0;i=per)
			strcpy(c[q].name,name_peo),
			c[q].all_score=sum,
			q++;
		}
		sort(c,c+q,cmp);
		printf("%d\n",q);
		for(int i=0;i

你可能感兴趣的:(poj1236)