//编写程序使学生的档案记录按照学号从小到大进行排序

//编写程序使学生的档案记录按照学号从小到大进行排序 
#include
#define student__num 5
#include 
struct student
{
   int num;
   char name[20];
   char sex;
   float score;       
       
       
} ;

void displaystudentinfo(const student [],int );
void sortarray(student [],int);
int main()
{
  student theclass[student__num]={    
                                  {110,"zhang ping",'M',45},
                                  {120,"li xiaoming",'M',92},
                                  {153,"wang gang",'N',89},
                                  {456,"weishanshan",'N',98},
                                  {444,"wiehsfff",'M',99} 
                                  };
  cout<<"Initial student information:\n";
  displaystudentinfo(theclass,student__num);
  
  cout<<"\nAfter sorting:\n";
  sortarray(theclass,student__num);
  displaystudentinfo(theclass,student__num);
  
  getch(); 
  return 0; 
                                  
                                   
} 


void displaystudentinfo(const student studs[],int len)
{
   for(int i=0;i

你可能感兴趣的:(C++)