原创  1001 收藏

#include <iostream.h>


int main(int argc, char* argv[])
{
 int n,i,j,num[500],theme[500],temp;
 while(cin>>n)
 {
 for(i=0;i<n;i++)
  cin>>num[i]>>theme[i];
 for(i=0;i<n-1;i++)
  for(j=0;j<n-i-1;j++)
   if(theme[j]<theme[j+1])
   {
    temp=theme[j];
    theme[j]=theme[j+1];
    theme[j+1]=temp;

    temp=num[j];
    num[j]=num[j+1];
    num[j+1]=temp;
   }
 for(i=0;i<n;i++)
  cout<<num[i]<<" "<<theme[i]<<endl;
 }
 return 0;
}

发表于 @ 2006年04月07日 21:27:00 | 评论( loading... ) | 编辑| 举报| 收藏

旧一篇:开张第一帖 | 新一篇:C语言高级测试:为C程序员准备的0x10个最佳问题

  • 发表评论
  • 评论内容:
  •  
Copyright © yaoweibin
Powered by CSDN Blog