/***************************************
*版权所有 (C)2017,liuzhaojing
*文件名称:stu.h
*文件标识:无
*内容摘要:定义数据和函数声明
*其他说明:无
*当前版本:V1.0
*作者:刘照京
*完成时间:20171222
*修改记录:
*修改时间:20171222
*版本号:V1.0
*修改人:liuzhaojing
****************************************/
#include "stdio.h"
#include "stdlib.h"
#include "string.h"
#include "conio.h"
#define N sizeof(struct student) //测结构体变量的大小//
typedef struct student
{
char number[20];
char name[20];
char sex[20];
char Tel[20];
char college[20];
char mail[20];
int score;//成绩
struct student *next;
} stu; //为结构体命名//
stu *creatlink( stu * &head); //创建链表信息//
stu *delet(stu *p0); //删除信息//
stu *modify(stu *h); //修改信息//
void findNum(stu *h); //查询信息//
void findName(stu *h); //查询信息//
void print(stu *p); //显示全部信息//
stu *sort(stu *head); //冒泡排序
int MainMenu();
int FindMenu();
int ManageMenu();
int StudentMenu();
void findNum(stu *h);
void findName(stu *h);
源文件main.cpp
[cpp] view plain copy
/***************************************
*版权所有 (C)2016,liuzhaojing
*文件名称:main.cpp
*文件标识:无
*内容摘要:每个函数的实现以及主函数
*其他说明:无
*当前版本:V1.0
*作者:刘照京
*完成时间:20171222
*修改记录:
*修改时间:20171222
*版本号:V1.0
*修改人:liuzhaojing
****************************************/
#include"stu.h"
int main()
{
int nChoose1;
int nChoose2;
int nChoose3;
int nChoose4;
int nEnd = 1;
int nEnd2 = 1;
int nEnd3 = 1;
char sName[10];
char sPassword[10];
int i; //choice用于选择对数据执行操作,i循环,ok主界面选择//
stu *head;
head = NULL;
while (nEnd)
{
nChoose1 = MainMenu();
switch (nChoose1)
{
case 0:
nEnd = 0;
break;
case 1:
printf("**************************************\n");
printf("请输入账号:\n");
scanf("%s", sName);
printf("**************************************\n");
printf("请输入密码:\n");
scanf("%s", sPassword);
if (strcmp(sName,"root")!=0)
{
printf("账号错误!\n");
}
else
{
if (strcmp(sPassword,"root")!=0)
{
printf("密码错误!\n");
}
else
{
nEnd2 = 1;
while (nEnd2)
{
nChoose2 = ManageMenu();
switch (nChoose2)
{
case 1:
head = creatlink(head);
break;
case 2:
head = delet(head);
break;
case 3:
head = modify(head);
break;
case 4:
nChoose4 = FindMenu();
switch (nChoose4)
{
case 1: