- #include <iostream.h>
- #include <stdlib.h>
- extern int ex1();
- extern int ex2();
- extern int ex3();
- extern int ex4();
- int main()
- {
- char str[20];
- while(1)
- {
- system("cls");
- cout<<"/n/n/n/n 数据结构课程设计程序各课题菜单选择界面/n/n"
- <<" ┌────────────────────────┐/n"
- <<" │课题一:运动会统计…………………………………<1> │/n"
- <<" │ │/n"
- <<" │课题二:航空订票系统………………………………<2> │/n"
- <<" │ │/n"
- <<" │课题三:文本编辑……………………………………<3> │/n"
- <<" │ │/n"
- <<" │课题四:猴子选大王…………………………………<4> │/n"
- <<" │ │/n"
- <<" │帮助:…………………………………………………<H> │/n"
- <<" │ │/n"
- <<" │退出本程序:…………………………………………<Q> │/n"
- <<" ├───────────────┬────────┤/n"
- <<" │注释:<>中的为操作参数。 │ 制作:夏午心晴 │/n"
- <<" └───────────────┴────────┘/n"
- <<"/n 请输入(1,2,3,4或Q)已完成相应的功能:";
- cin>>str;
- switch(str[0])
- {
- case'1':system("cls");ex1();break;
- case'2':system("cls");ex2();break;
- case'3':system("cls");ex3();break;
- case'4':system("cls");ex4();break;
- case'h':
- case'H':system("help.htm");break;
- case'q':
- case'Q':return 0;
- }
- };
- return 0;
- }
- #include <iostream.h>
- #include <stdlib.h>
- #define N 20
- const int ji[2][5]={ {7,5,3,2,1},{5,3,2}};
- struct xiangmu
- {
- int school[5],qu;
- }*xm;
- struct IN
- {
- int score,m,w,num;
- }s[N];
- int m,w,n,i;
- int cmp_school_num(const void *a , const void *b )
- {
- return ((IN*)b)->num - ((IN*)a)->num;
- }
- int cmp_school_score(const void *a , const void *b )
- {
- return ((IN*)b)->score - ((IN*)a)->score;
- }
- int cmp_school_m(const void *a , const void *b )
- {
- return ((IN*)b)->m - ((IN*)a)->m;
- }
- int cmp_school_w(const void *a , const void *b )
- {
- return ((IN*)b)->w - ((IN*)a)->w;
- }
- void csh()
- {
- m=0;w=0;n=0;i=0;
- for(int tp=0;tp<N;tp++)
- {
- s[tp].num=tp+1;
- s[tp].score=0;
- s[tp].m=0;
- s[tp].w=0;
- }
- }
- void luru(struct xiangmu *xm)
- {
- int r,temp;
- for(int tp=0;tp<i;tp++)
- {
- cout<<((tp<m)?"请输入男子项目记入前几名":"请输入女子项目记入前几名")<<"(项目号:"<<tp+1<<")"<<endl;
- cin>>(xm+tp)->qu;
- if((xm+tp)->qu==5)
- r=0;
- else
- r=1;
- cout<<"请输入取得前几名的学校编号:/n";
- for(int tp1=0;tp1<((xm+tp)->qu);tp1++)
- {
- cin>>temp;
- (xm+tp)->school[tp1]=temp-1;
- s[(xm+tp)->school[tp1]].score+=ji[r][tp1];
- tp<m?(s[(xm+tp)->school[tp1]].m+=ji[r][tp1]):(s[(xm+tp)->school[tp1]].w+=ji[r][tp1]);
- }
- }
- }
- void pai_num()
- {
- qsort(s,N,sizeof(s[0]),cmp_school_num);
- cout<<"按学校编号输出"<<endl;
- for(int tp=N-1;tp>-1;tp--)
- cout<<"学校编号"<<s[tp].num<<",总分数为:"<<s[tp].score<<"分。"<<endl;
- cout<<endl;
- }
- void pai_school()
- {
- qsort(s,N,sizeof(s[0]),cmp_school_score);
- cout<<"学校总分排名情况"<<endl;
- for(int tp=0;s[tp].score>0;tp++)
- cout<<"第"<<