如何用C语言设计出一个学生信息查询系统的程序?

如题所述

<<"1.输入/添加学生资料"<<endl<<" 

2.输出学生资料"<<endl<<" 

3.查找"<<endl<<" 

4.删除"<<endl<<" 

5.总分排序"<<endl<<" 

6.退出"<<endl<<endl<<" 

请选择你要的服务(1-6)"<<endl;cin>>chose;if(chose=='6'){break;}switch(chose){case'1':// 

输入学生信息{do{cout<<"

请输入学生姓名:"<<endl;ch1=newchar[];ch2=newchar[];cin>>ch1;cout<<"

请输入学号:"<<endl;cin>>num;while(st.check_num(num)){cout<<"

学号重复,请重新输入"<<endl;cin>>num;}cout<<"

请输入地址:"<<endl;cin>>ch2;cout<<"

请输入高数成绩:"<<endl;cin>>x;cout<<"

请输入英语成绩:"<<endl;cin>>y;cout<<"

请输入计算机成绩:"<<endl;cin>>z;st.input(ch1,num,ch2,x,y,z);printf("\n

是否继续输入学生信息?(\"y\"继续)");scanf("%s",flag);}while(strcmp(flag,"y")==0);}break;case'2':// 

输出学生资料{temp=count;count=1;cout<<"

序号\t姓名\t学号\t\t地址\t\t\t高数\t英语\t计算机"<<endl;while(count<=temp){st.show();count++;}count--;getch();}break;case'3':{cout<<"

请输入你要查找学生的学号"<<endl;cin>>find;st.find(find);}break;case'4':{cout<<"

请输入你要删除的学生学号"<<endl;cin>>del;st.del(del);}break;case'5':{st.taxis();}break;

default:{cout<<"输入错误!!!,请重新输入"<<endl;getch();}}}cout<<"感谢你的使用!\n"<<endl;getch();

}

#include<stdio.h>

#include<windows.h>

#include<string.h>

structworker

{

intnum;

charname[20];

charzhicheng[10];

intwages;

intreward;

longbirth;

intsalary;

}work[500],work1;/*定义结构体*/

voidmenu();//声明菜单函数

voidtype_in();//声明录入函数

voidbaocun(int);//声明保存函数

voidscan();//声明浏览函数

voiddel();//声明删除函数

voidsearch();//声明查询函数

voidsearch_zhicheng();//声明按职称查询函数

voidsearch_name();//声明按姓名查找函数

voidchange();//声明修改函数

voidorder();//声明排序函数

voidadd();//声明添加函数

voidorder_wages();

voidorder_name();

voidmenu()/*菜单函数*/

{

printf("\n");

printf("welcometo\n");

printf("职工信息管理系统");

printf("******************************************************************************\n");

printf("1.录入职工信息\n");

printf("2.浏览职工信息\n");

printf("3.查询职工信息\n");

printf("4.删除职工信息\n");

printf("5.修改职工信息\n");

printf("6.职工信息排序\n");

printf("7.添加职工信息\n");

printf("8.退出\n");

printf("*******************************************************************************\n");

printf("\n");

}

/********************************************************************************************/

voidmain()

{

intn,f;

while(1)

{

do

{

menu();/*调用菜单函数*/

printf("请输入你需要操作的序号(1—8):\n");

scanf("%d",&n);

if(n>=1&&n<=8)

{

f=1;

break;

}

else

{

f=0;

printf("您输入有误,请重新选择!");

}

}while(f==0);

switch(n)

{

case1:printf("录入职工信息\n");printf("\n");type_in();break;

case2:printf("浏览职工信息\n");printf("\n");system("cls");scan();break;

case3:printf("查询职工信息\n");printf("\n");system("cls");search();break;

case4:printf("删除职工信息\n");printf("\n");system("cls");del();break;

case5:printf("修改职工信息\n");printf("\n");system("cls");change();break;

case6:printf("职工信息排序\n");printf("\n");system("cls");order();break;

case7:printf("添加职工信息\n");printf("\n");system("sls");add();break;

case8:gotoloop;/*用goto语句跳至跳至指定的行*/

default:break;

}

}

loop://行标

system("cls");

printf("\n\n\n\n\n\n-----

温馨提示:答案为网友推荐,仅供参考
相似回答