C++经典习题

来源:互联网 发布:深圳软件学校 编辑:程序博客网 时间:2024/05/22 02:26

1、  设计一个立方体类BOX,它能计算并输出立方体的体积和表面积。

   提示:定义一个BOX类,含有一个私有数据成员(立方体边长length),有两个公有数据函数(构造

         函数Box和计算输出函数show)

 

[cpp] view plain copy
  1. /** 
  2.  *  立方体类 
  3.  *  作者:hellostory 
  4.  *  日期:2010-11-23 
  5.  */  
  6. #include <iostream>  
  7. using namespace std;  
  8.   
  9. class Box  
  10. {  
  11. private:  
  12.     double length;  //立方体边长  
  13.     double volume;  //体积  
  14.     double area;    //表面积  
  15. public:  
  16.     /* 
  17.      *  构造函数 
  18.      */  
  19.     Box(double l)  
  20.     {  
  21.         length = l;  
  22.         volume = 0.0;  
  23.         area = 0.0;  
  24.     }  
  25.   
  26.     /* 
  27.      *  计算体积 
  28.      */  
  29.     double getVolume()  
  30.     {  
  31.         return length * length * length;  
  32.     }  
  33.   
  34.     /* 
  35.      *  计算表面积 
  36.      */  
  37.     double getArea()  
  38.     {  
  39.         return length * length * 6;  
  40.     }  
  41.   
  42.     /* 
  43.      *  输出立方体体积和表面积 
  44.      */  
  45.     void show()  
  46.     {  
  47.         volume = getVolume();  
  48.         area = getArea();  
  49.         cout<<"立方体的体积:"<<volume<<",表面积:"<<area<<endl;  
  50.     }  
  51. };  
  52.   
  53. /* 
  54.  *  主函数 
  55.  */  
  56. int main()  
  57. {  
  58.     int length = 0;  
  59.     cout<<"请输入立方体的边长:";  
  60.     cin>>length;  
  61.     Box box(length);  
  62.     box.show();  
  63.     getchar();  
  64.     return 0;  
  65. }  
  

 

2、  有5个学生,每个学生的数据包括学号、姓名、三门课成绩,从键盘输入5个学生的数据,要求计算并输出。

1)  每个学生三门课的总成绩

2)  三门课每门课程的平均成绩

 

[cpp] view plain copy
  1. /** 
  2.  *  学生成绩管理 
  3.  *  作者:hellostory 
  4.  *  日期:2010-11-23 
  5.  */  
  6. #include<string>  
  7. #include<iostream>  
  8. using namespace std;  
  9.   
  10. #define N 5 //定义常量N=5  
  11.   
  12. // 定义学生结构体  
  13. typedef struct  
  14. {  
  15.     string no;      //学号  
  16.     string name;    //姓名  
  17.     float chinese;  //语文  
  18.     float math;     //数学  
  19.     float english;  //英语  
  20.     float total;    //总成绩  
  21. }Student;  
  22.   
  23. // 定义5个学生  
  24. Student stu[N];  
  25.   
  26. /* 
  27.  *  录入每个学生的成绩等 
  28.  */  
  29. void input(int n)  
  30. {  
  31.     string no;      //学号  
  32.     string name;    //姓名  
  33.     float chinese;  //语文  
  34.     float math;     //数学  
  35.     float english;  //英语  
  36.   
  37.     for(int i=0; i!=n; i++)  
  38.     {  
  39.         cout<<"请输入第"<<i+1<<"个学生的学号:";  
  40.         cin>>no;  
  41.         stu[i].no = no;  
  42.         cout<<"请输入该学生的姓名:";  
  43.         cin>>name;  
  44.         stu[i].name = name;  
  45.         cout<<"请输入该学生语文成绩:";  
  46.         cin>>chinese;  
  47.         stu[i].chinese = chinese;  
  48.         cout<<"请输入该学生数学成绩:";  
  49.         cin>>math;  
  50.         stu[i].math = math;  
  51.         cout<<"请输入该学生英语成绩:";  
  52.         cin>>english;  
  53.         stu[i].english = english;  
  54.           
  55.         // 计算该学生三门课的总成绩  
  56.         stu[i].total = stu[i].chinese + stu[i].math + stu[i].english;  
  57.     }  
  58. }  
  59.   
  60. /* 
  61.  *  打印三门课每门课程的平均成绩 
  62.  */  
  63. void printAvg()  
  64. {  
  65.     int i = 0;  
  66.     float sumChinese=0, sumMath=0, sumEnglish=0;   
  67.     float avgChinese=0, avgMath=0, avgEnglish=0;  
  68.   
  69.     for(i=0; i<N; i++)  
  70.     {  
  71.         sumChinese += stu[i].chinese;  
  72.         sumMath += stu[i].math;  
  73.         sumEnglish += stu[i].english;  
  74.     }  
  75.       
  76.     avgChinese = sumChinese / N;  
  77.     avgMath = sumMath / N;  
  78.     avgEnglish = sumEnglish / N;  
  79.   
  80.     cout<<"语文课:"<<avgChinese<<"/r/n";  
  81.     cout<<"数学课:"<<avgMath<<"/r/n";  
  82.     cout<<"英语课:"<<avgEnglish<<"/r/n";  
  83. }  
  84.   
  85. /* 
  86.  *  主函数 
  87.  */  
  88. void main()  
  89. {  
  90.     // 录入每个学生的成绩等  
  91.     input(N);  
  92.   
  93.     cout<<"/r/n---------- 统计结果 ----------/r/n";  
  94.     cout<<"以下是每个学生三门课的总成绩:"<<"/r/n";  
  95.     for (int i=0; i<N; i++)  
  96.     {  
  97.         cout<<stu[i].name<<":"<<"/t"<<stu[i].total<<"/r/n";  
  98.     }  
  99.   
  100.     cout<<"/r/n以下是每门课的平均成绩:"<<"/r/n";  
  101.     printAvg();  
  102.   
  103.     // 接收多余的"/r/n"  
  104.     getchar();  
  105.     getchar();  
  106. }   

3、  假定居民的基本数据包括身份证号、姓名、性别和出生日期,而居民中的成年人又多项数据:最高学历和职业,成年人中的党员又多一项数据:党员类别。现要求建立三个类,让成年人类继承居民类,而党员类继承成年人类,并要求在每个类中都提供有数据输入和输出的功能。

 

[cpp] view plain copy
  1. /** 
  2.  *  C++类继承 
  3.  *  作者:hellostory 
  4.  *  日期:2010-11-23 
  5.  */  
  6.   
  7. #include<string>  
  8. #include<iostream>  
  9. using namespace std;  
  10.   
  11. /* 
  12.  *  居民类 
  13.  */  
  14. class People  
  15. {  
  16. private:  
  17.     char id[19];    //身份证号  
  18.     char name[11];  //姓名  
  19.     char sex[4];    //性别  
  20.     char birth[11]; //出生日期  
  21.       
  22. public:  
  23.     void input() {  
  24.         cout<<"请按顺序(身份证号、姓名、性别、出生日期--用回车隔开)输入居民信息:"<<endl;  
  25.         cin>>id>>name>>sex>>birth;  
  26.     }  
  27.   
  28.     void output() {  
  29.         cout<<id<<' '<<name<<' '<<sex<<' '<<birth<<endl;  
  30.     }  
  31. };  
  32.   
  33. /* 
  34.  *  成人类 
  35.  */  
  36. class Adult: public People {  
  37. private:  
  38.     char education[11]; //最高学历  
  39.     char job[11];       //职业  
  40. public:  
  41.         void input() {  
  42.             People::input();  
  43.             cout<<"请输入最高学历和职业(用回车隔开):"<<endl;  
  44.             cin>>education>>job;  
  45.         }  
  46.           
  47.         void output() {  
  48.             People::output();  
  49.             cout<<education<<' '<<job<<endl;  
  50.         }  
  51.  };  
  52.   
  53. /* 
  54.  *  党员类 
  55.  */  
  56. class Party: public Adult {  
  57. private:  
  58.     char parties[15]; //党员类别  
  59. public:  
  60.         void input() {  
  61.             Adult::input();  
  62.             cout<<"请输入党员类别:"<<endl;  
  63.             cin>>parties;  
  64.         }  
  65.         void output() {  
  66.             cout<<"/n/r输出党员信息:"<<endl;  
  67.             Adult::output();  
  68.             cout<<parties<<endl;  
  69.         }  
  70. };  
  71.   
  72. // 程序入口  
  73. void main()  
  74. {  
  75.     // 测试党员类(按继承关系可以一起测试居民类、成人类)  
  76.     Party party;  
  77.     party.input();  
  78.     party.output();  
  79. }  

 

 

4、  设计一个时钟类,能够记录时、分、秒,重载它的++运算符,每执行一次++运算,加时1秒,但要使计时过程能够自动进位。

 

[cpp] view plain copy
  1. /** 
  2.  *  C++时钟 
  3.  *  作者:hellostory 
  4.  *  日期:2010-11-23 
  5.  */  
  6. #include<iostream>  
  7. #include<cmath>  
  8. using namespace std;  
  9.   
  10. /* 
  11.  *  时钟类 
  12.  */  
  13. class Clock   
  14. {  
  15. private:   
  16.     int Hour, Minute, Second;  
  17. public:   
  18.     Clock(int h=0, int m=0, int s=0);  
  19.     void ShowTime();  
  20.     Clock& operator ++();   
  21.     Clock operator ++(int);  
  22. };  
  23.   
  24. /* 
  25.  *  时钟类构造函数 
  26.  */  
  27. Clock::Clock(int h,int m, int s)  
  28. {  
  29.     if(h>=0 && h<=24 && m>=0 && m<=60 && s>=0 && s<=60)  
  30.     {  
  31.         Hour = h;  
  32.         Minute =m;   
  33.         Second= s;  
  34.     }  
  35.     else  
  36.         cout<<"输入的时间格式错误!"<<endl;  
  37. }  
  38.   
  39. /* 
  40.  *  显示时间 
  41.  */  
  42. void Clock::ShowTime()  
  43. {  
  44.     cout<<Hour<<":"<<Minute<<":"<<Second<<endl;  
  45. }  
  46.   
  47. /* 
  48.  *  时间递增一秒(重载前缀++运算符) 
  49.  */  
  50. Clock& Clock::operator ++()   
  51. {   
  52.     Second++;  
  53.     if (Second >= 60)  
  54.     {  
  55.         Second = Second - 60;  
  56.         Minute++;  
  57.         if (Minute >= 60)  
  58.         {  
  59.             Minute = Minute - 60;  
  60.             Hour++;  
  61.             Hour = Hour % 24;  
  62.         }  
  63.     }  
  64.     return *this;  
  65. }  
  66.   
  67. /* 
  68.  *  时间递增一秒(重载后缀++运算符) 
  69.  */  
  70. Clock Clock::operator ++(int)  
  71. {  
  72.     Clock old = *this;  
  73.     ++(*this);  
  74.     return old;  
  75. }  
  76.   
  77. /* 
  78.  *  主函数 
  79.  */  
  80. void main()  
  81. {  
  82.     Clock myClock(23,59,59);  
  83.     cout<<"初始化显示时间为:/t/t";  
  84.     myClock.ShowTime();  
  85.   
  86.     cout<<"执行myClock++后的时间为:/t";  
  87.   
  88.     //先执行ShowTime(),输出myClock=23:59:59,  
  89.     //再执行myClock++,此时myClock=00:00:00  
  90.     (myClock++).ShowTime();  
  91.   
  92.     cout<<"执行++myClock后的时间为:/t";  
  93.   
  94.     //先执行++myClock,此时myClock=00:00:01  
  95.     //再执行ShowTime(),输出myClock=00:00:01  
  96.     (++myClock).ShowTime();  
  97. }  

 

 

5、 简化的职工档案管理程序。其中把职工的档案数据和对这些数据的设置、修改、删除、添加等操作组成一个程序模块。程序通过这个模块一类的公有部分对档案数据进行处理,实现了面向对象程序设计的“封装”功能。

   说明:需要在同目录下新建一个文件sort.txt

 

[cpp] view plain copy
  1. /** 
  2.  *  职工档案数据管理系统 
  3.  *  作者:hellostory 
  4.  *  日期:2010-11-23 
  5.  */  
  6. #include <iostream>  
  7. #include <fstream>  
  8. #include <string.h>  
  9. #include <conio.h>  
  10. using namespace std;  
  11.   
  12. // 职工类Staff  
  13. class Staff  
  14. {  
  15. public:  
  16.     char Id[20];    //工号  
  17.     char name[20];  //姓名  
  18.     char sex[10];   //性别  
  19.     char dept[20];  //部门  
  20.       
  21.     Staff * Next;   //指向下一个职工节点  
  22.   
  23.     // 录入一个职工的档案数据  
  24.     void Input()  
  25.     {  
  26.         cout<<"/t请输入新职工的档案数据:"<<endl;  
  27.         cout<<"/t工号:";  cin>>Id;  
  28.         cout<<"/t姓名:";  cin>>name;  
  29.         cout<<"/t性别:";  cin>>sex;  
  30.         cout<<"/t部门:";  cin>>dept;  
  31.     }  
  32.   
  33.     // 从文件(sort.txt)输入流中读取一行数据赋值给Staff对象  
  34.     void ReadFile(istream & in)  
  35.     {  
  36.         in>>Id>>name>>sex>>dept;  
  37.     }  
  38.   
  39.     // 显示该职工的档案数据  
  40.     void Show()  
  41.     {  
  42.         cout<<"/t工号/t姓名/t性别/t部门"<<endl;  
  43.         cout<<"/t"<<Id<<"/t"<<name<<"/t"<<sex<<"/t"<<dept<<endl;  
  44.     }  
  45. };  
  46.   
  47. // 职工档案数据管理类Staffmassage  
  48. class Staffmassage  
  49. {  
  50. private:  
  51.     Staff * Head,* End;  
  52.     ifstream in;  
  53.     ofstream out;  
  54.   
  55.     // 根据职工姓名查找并返回职工档案数据(返回前一个节点)  
  56.     Staff *FindItem(char * name)  
  57.     {  
  58.         for(Staff *p=Head; p->Next != End; p=p->Next)  
  59.         {  
  60.             if(!strcmp(p->Next->name,name))  
  61.                 return p;  
  62.         }  
  63.         return NULL;  
  64.     }  
  65.   
  66.     // 根据职工工号查找并返回职工档案数据(返回前一个节点)  
  67.     Staff *FindID(char * Id)  
  68.     {  
  69.         for(Staff * p=Head; p->Next!=End; p=p->Next)  
  70.         {  
  71.             if(!strcmp(p->Next->Id,Id))  
  72.                 return p;  
  73.         }  
  74.         return NULL;  
  75.     }  
  76.   
  77. public:  
  78.     Staffmassage();  
  79.     ~Staffmassage();  
  80.     void ShowMenu();  
  81.     void Find();  
  82.     void Save();  
  83.     void ModifyItem();  
  84.     void RemoveItem();  
  85.     void Swap(Staff *,Staff *);  
  86.     void Sort();  
  87.     int ListCount();  
  88.   
  89.     // 显示全部职工的档案数据  
  90.     void Display()  
  91.     {  
  92.         for(Staff *p=Head->Next; p!=End; p=p->Next){  
  93.             p->Show();  
  94.         }  
  95.         cout<<"/t输入任意字符继续...";  
  96.         getch();  
  97.     }  
  98.   
  99.     // 增加职工档案数据  
  100.     void AddItem()  
  101.     {  
  102.         End->Input();  
  103.         End->Next = new Staff;  
  104.         End = End->Next;  
  105.         cout<<"/t添加成功!"<<endl;  
  106.         cout<<"/t输入任意字符继续...";  
  107.         getch();  
  108.     }  
  109. };  
  110.   
  111. // 构造函数  
  112. Staffmassage::Staffmassage()  
  113. {  
  114.     Head = new Staff;  
  115.     Head->Next = new Staff;  
  116.     End = Head->Next;  
  117.     in.open("sort.txt");  
  118.     if(!in)  
  119.         cout<<"系统无任何职工档案数据!请先录入职工档案数据!"<<endl;  
  120.     else  
  121.     {  
  122.         while(!in.eof())  
  123.         {  
  124.             End->ReadFile(in);  
  125.             if(End->name[0]=='/0')   break;  
  126.             End->Next = new Staff;  
  127.             End = End->Next;  
  128.         }  
  129.         in.close();  
  130.         cout<<"读取职工档案数据成功!"<<endl;  
  131.     }  
  132. }  
  133.   
  134. // 析构函数  
  135. Staffmassage::~Staffmassage()  
  136. {  
  137.     // 将职工档案数据保存在文本文件中  
  138.     Save();  
  139.     // 删除存放职工档案数据的链表  
  140.     for(Staff * temp;Head->Next!=End;)  
  141.     {  
  142.         temp=Head->Next;  
  143.         Head->Next=temp->Next;  
  144.         delete temp;  
  145.     }  
  146.     delete Head,End;  
  147. }  
  148.   
  149. //  显示系统菜单  
  150. void Staffmassage::ShowMenu()                    
  151. {  
  152.     cout<<"/t              ┏━━━━━━━━━━━━━━┓              "<<endl;  
  153.     cout<<"/t┏━━━━━━┫   职  工  管  理  系  统   ┣━━━━━━┓"<<endl;  
  154.     cout<<"/t┃            ┗━━━━━━━━━━━━━━┛            ┃"<<endl;  
  155.     cout<<"/t┃       1.增加职工档案数据      4.查找职工档案数据       ┃"<<endl;  
  156.     cout<<"/t┃       2.显示职工档案数据      5.删除职工档案数据       ┃"<<endl;  
  157.     cout<<"/t┃       3.排序统计档案数据      6.修改职工档案数据       ┃"<<endl;  
  158.     cout<<"/t┃       0.安全退出系统                                   ┃"<<endl;  
  159.     cout<<"/t┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛"<<endl;  
  160.     cout<<"/n/t请选择:";  
  161. }  
  162.   
  163. // 查找并显示职工档案数据  
  164. void Staffmassage::Find()  
  165. {  
  166.     char name[20] ,Id[10];  
  167.     int x;  
  168.     Staff * p=NULL;  
  169.     cout<<"/n/t━━━━━━━━━━━━━━━━━/n";  
  170.     cout<<"/t 1.按职工的姓名查找  2.按职工学号查找";  
  171.     cout<<"/n/t━━━━━━━━━━━━━━━━━/n/t请选择:";  
  172.     cin>>x;  
  173.     switch(x)  
  174.     {  
  175.         case 1:  
  176.             {  
  177.                 cout<<"/t请输入要查找的职工的姓名:";  
  178.                 cin>>name;  
  179.                 if(p=FindItem(name))  
  180.                 {  
  181.                     p->Next->Show();  
  182.                     cout<<"/t输入任意字符继续...";  
  183.                     getch();  
  184.                 }  
  185.                 else  
  186.                 {  
  187.                     cout<<"/t没有找到该姓名的职工!/n"<<endl;  
  188.                     cout<<"/t输入任意字符继续...";  
  189.                     getch();  
  190.                 }  
  191.             }  
  192.             break;  
  193.         case 2:  
  194.             {  
  195.                 cout<<"/t请输入要查找的职工的学号:";  
  196.                 cin>>Id;  
  197.                 if(p=FindID(Id))  
  198.                 {  
  199.                     p->Next->Show();  
  200.                     cout<<"/t输入任意字符继续...";  
  201.                     getch();  
  202.                 }  
  203.                 else  
  204.                 {  
  205.                     cout<<"/t没有找到该工号的职工!/n"<<endl;  
  206.                     cout<<"/t输入任意字符继续...";  
  207.                     getch();  
  208.                 }  
  209.             }  
  210.             break;  
  211.     }   
  212. }  
  213.   
  214. // 修改职工档案数据  
  215. void Staffmassage::ModifyItem()  
  216. {  
  217.     char name[20];  
  218.     Staff * p=NULL;  
  219.     cout<<"/t请输入要修改的职工姓名:";  
  220.     cin>>name;  
  221.     if(p=FindItem(name))  
  222.     {  
  223.         cout<<"/t已找到职工的档案数据,请输入新的档案数据!"<<endl;  
  224.         p->Next->Input();  
  225.         cout<<"/t修改成功!"<<endl;  
  226.         cout<<"/t输入任意字符继续...";  
  227.         getch();  
  228.     }  
  229.     else  
  230.     {  
  231.         cout<<"/t对不起,没有找到该职工档案数据!"<<endl;  
  232.         cout<<"/t输入任意字符继续...";  
  233.         getch();  
  234.     }  
  235. }  
  236.   
  237. // 根据职工姓名删除对应的档案数据  
  238. void Staffmassage::RemoveItem()  
  239. {  
  240.     char name[20];  
  241.     Staff * p=NULL,*temp=NULL;  
  242.     cout<<"/t请输入要删除的职工的姓名:"<<endl;cin>>name;  
  243.     if(p=FindItem(name))  
  244.     {  
  245.         // 先使被删除职工的前一个节点Next指向其下一个节点  
  246.         temp=p->Next;  
  247.         p->Next=temp->Next;   
  248.         // 再删除该职工节点数据  
  249.         delete temp;  
  250.         cout<<"/t删除成功!"<<endl;  
  251.         cout<<"/t输入任意字符继续...";  
  252.         getch();  
  253.     }  
  254.     else  
  255.     {  
  256.         cout<<"/t对不起,没有找到该职工档案数据!"<<endl;  
  257.         cout<<"/t输入任意字符继续...";  
  258.         getch();  
  259.     }  
  260. }  
  261.   
  262. // 交换两个职工的档案数据  
  263. void Staffmassage::Swap(Staff *p1, Staff *p2)  
  264. {  
  265.     Staff *temp=new Staff;   
  266.     strcpy(temp->Id,p1->Id);  
  267.     strcpy(temp->name,p1->name);    
  268.     strcpy(temp->sex,p1->sex);  
  269.     strcpy(temp->dept,p1->dept);  
  270.    
  271.     strcpy(p1->Id,p2->Id);  
  272.     strcpy(p1->name,p2->name);      
  273.     strcpy(p1->sex,p2->sex);  
  274.     strcpy(p1->dept,p2->dept);  
  275.    
  276.     strcpy(p2->name,temp->name);  
  277.     strcpy(p2->Id,temp->Id);  
  278.     strcpy(p2->sex,temp->sex);  
  279.     strcpy(p2->dept,temp->dept);  
  280. }  
  281.   
  282. //  统计当前链表的记录总数,返回一个整数  
  283. int Staffmassage::ListCount()  
  284. {  
  285.     if(!Head)  
  286.     {  
  287.         return 0;  
  288.     }  
  289.     int n=0;  
  290.     for(Staff * p=Head->Next;p!=End;p=p->Next)  
  291.     {  
  292.         n++;  
  293.     }  
  294.     return n;  
  295. }  
  296.   
  297. //  对当前链表进行排序(采用选择排序算法)  
  298. void Staffmassage::Sort()  
  299. {   
  300.     cout <<"/t正在排序(按工号从小到大)..."<<endl;  
  301.     Staff *p=NULL,*p1=NULL,*k=NULL;  
  302.     int n=Staffmassage::ListCount();  
  303.     if(n<2) return;  
  304.     for(p=Head->Next; p!=End; p=p->Next)  
  305.     {  
  306.         for(k=p->Next;k!=End;k=k->Next)  
  307.         {  
  308.             if(p->Id < k->Id)  
  309.             {  
  310.                 Staffmassage::Swap(p,k);  
  311.             }  
  312.         }  
  313.     }  
  314.     cout <<"/t排序完成!"<<endl;  
  315.     getch();  
  316.     return;  
  317. }  
  318.   
  319. // 保存职工档案数据到文本文件"sort.txt"  
  320. void Staffmassage::Save()  
  321. {  
  322.     out.open("sort.txt");  
  323.     for(Staff *p=Head->Next;p!=End;p=p->Next)  
  324.     {  
  325.         out<<p->Id<<"/t"<<p->name<<"/t"<<p->sex<<"/t"<<p->dept<<'/n';  
  326.     }  
  327.     out.close();  
  328. }  
  329.   
  330. // 主函数(程序入口)  
  331. int main()  
  332. {  
  333.     cout<<"欢迎进入【职工档案数据管理系统】!"<<endl;  
  334.     Staffmassage Grade; //创建职工档案管理对象  
  335.     cout<<"按任意键开始……";  
  336.     getch();  
  337.   
  338.     int x;    
  339.     bool quit = false;  
  340.     while(!quit)  
  341.     {  
  342.         system("cls");      //清除DOS屏幕  
  343.         Grade.ShowMenu();   //显示系统菜单  
  344.         cin>>x;  
  345.         switch(x)  
  346.         {  
  347.             case 0:quit=true;break;  
  348.             case 1:Grade.AddItem();break;  
  349.             case 2:Grade.Display();break;  
  350.             case 3:Grade.Sort();break;  
  351.             case 4:Grade.Find();break;  
  352.             case 5:Grade.RemoveItem();break;  
  353.             case 6:Grade.ModifyItem();break;  
  354.         }  
  355.     }  
  356.     return 0;  
原创粉丝点击