#include<iostream>
#include<fstream>
#include<string>
#include<iomanip>
using namespace std;
#define NULL 0
int n=0; //链表节点数
bool formExist=false; //原有链表是否存在
struct Singer
{大气压力是多少
string name;
long num;
int sum;
int mark[10];
float average;
Singer *next;
};
//创建链表
Singer *create();
//打印信息
void print(Singer *pt);
//插入节点
Singer *insert(Singer *head,Singer *sin);
//保存到文件残疾赔偿金计算标准
void save(Singer *head,char filename[]);
//菜单
void menu();
//评委打分
void grade(Singer *head,int mark[]);
//成绩排序
void rank(Singer *head);
//欢迎
void welcome();
//按姓名查询
void inquire(Singer *head,string name);
//按编号查询
void inquire(Singer *head,long num);
//从文件导入
Singer *import(char filename[],Singer *head);
int main()
{
Singer *head=NULL;
Singer newsin;
string name;
void grade(Singer *);
ifstream infile;
char filename[20];
long num;
char choose;
bool quit=false;
char c;
welcome();
while(true)
{
menu();
cin>>choose;
switch(choose)
{
case '1':
if (formExist)
{
cout<<"您要创建新的链表,原有链表将丢失,是否继续?(Y/N)";
cin>>c;
if (!(c=='y'||c=='Y'))
continue;
else
{
n=0;
head=create();
system("pause");
break;
}
}else
{
head=create();
system("pause");
break;
}
case '2':
cout<<"请输入文件名:";
cin>>filename;
head=import(filename,head);
system("pause");
break;
case '3':
grade(head);
system("pause");
break;
case '4':
cout<<"排序结果为:"<<endl;
教师节贺卡上写什么内容 rank(head);
system("pause");
break;
case '5':
print(head);
system("pause");
break;
case '6':
cout<<"请输入姓名:"<<endl;
cin>>name;
inquire(head,name);
system("pause");
break;
case '7':
cout<<"请输入编号:"<<endl;
cin>>num;
inquire(head,num);演唱会 门票
system("pause");
break;
case '8':
cout<<"请输入新增选手的姓名、编号:"<<endl;
cin>>newsin.name;
cin>>newsin.num;
head=insert(head,&newsin);
system("pause");
break;
case 'k':
cout<<"请输入文件名:";
cin>>filename;
save(head,filename);
system("pause");
break;最新好看的韩剧
case 'c':
system("cls");
welcome();
break;
case 'q':
杨紫探班秦俊杰 quit=true;
break;
default:
cout<<"输入错误!"<<endl;
}
if (quit)
break;
}
//退出时提示保存
cout<<"您想保存这些信息吗? (Y/N)";
cin>>c;
if (c=='y' || c=='Y')
{
cout<<"请输入文件名:";
cin>>filename;
save(head,filename);
}
return 0;
}
//欢迎界面
void welcome()
{
cout<<"***************************************"<<endl
<<" 欢迎使用歌手比赛管理系统!"<<endl
<<"制作人:黄光亮 时间:2010-12-29"<<endl
<<"***************************************"<<endl<<endl;
}
//菜单
void menu()
{
cout<<setiosflags(ios::left);
cout<<"\n\n您要做什么?"<<endl
<<setw(20)<<"1.创建选手信息表"
<<setw(20)<<"2.从文件导入信息表"<<endl
<<setw(20)<<"3.评委打分"
<<setw(20)<<"4.成绩排序"<<endl
<<setw(20)<<"5.打印所有的信息"
<<setw(20)<<"6.按姓名查询"<<endl
<<setw(20)<<"7.按编号查询"
<<setw(20)<<"8.追加选手数据"<<endl
<<setw(20)<<"k.保存信息表到文件"
<<setw(20)<<"c.清空屏幕"<<endl
<<setw(20)<<"q.退出"<<endl<<endl
<<"输入您的选择:";
发布评论