|
|
|
@ -1,88 +1,84 @@
|
|
|
|
|
#include<stdio.h>
|
|
|
|
|
struct student
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
#include <conio.h>
|
|
|
|
|
int main()
|
|
|
|
|
{
|
|
|
|
|
int num;
|
|
|
|
|
char name[20];
|
|
|
|
|
int year;
|
|
|
|
|
char sex[10];
|
|
|
|
|
int birth[20];
|
|
|
|
|
char home[100];
|
|
|
|
|
int tel;
|
|
|
|
|
char e[20];
|
|
|
|
|
}stu[n];
|
|
|
|
|
void one()
|
|
|
|
|
{
|
|
|
|
|
int opt1;
|
|
|
|
|
printf("----------欢迎使用学生信息管理系统----------");
|
|
|
|
|
printf("\n\n");
|
|
|
|
|
printf(" 1: 2: 3: 4: ");
|
|
|
|
|
printf(" 请输入1 2 3 4 5中的任意一个选项进行操作:");
|
|
|
|
|
loop: scanf("%d",&opt1);
|
|
|
|
|
switch(opt1)
|
|
|
|
|
{
|
|
|
|
|
case 1: info();break;
|
|
|
|
|
case 2: data();break;
|
|
|
|
|
case 3: look();break;
|
|
|
|
|
case 4: help();break;
|
|
|
|
|
case 5: break;
|
|
|
|
|
default:
|
|
|
|
|
printf(" 输入错误,请重新输入1 2 3 4 5中的一项");
|
|
|
|
|
scanf("%d",&opt1);
|
|
|
|
|
goto loop;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
void info()
|
|
|
|
|
{
|
|
|
|
|
int opt2;
|
|
|
|
|
printf("\n\n 欢迎进入信息处理 \n\n");
|
|
|
|
|
printf(" 1.学生信息录入\n\n2。学生信息的修改\n\n");
|
|
|
|
|
printf(" 3.返回\n\n");
|
|
|
|
|
printf(" 请输入1 2 3中的任意一个选项进行操作");
|
|
|
|
|
loop: scanf("%d",&opt2)
|
|
|
|
|
switch(opt2)
|
|
|
|
|
{
|
|
|
|
|
case 1: info_1();break;
|
|
|
|
|
case 2: info_2();break;
|
|
|
|
|
case 3: one();break;
|
|
|
|
|
default:
|
|
|
|
|
{
|
|
|
|
|
printf("输入错误,请重新输入1 2 3中的一项");
|
|
|
|
|
goto loop;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
while(1)
|
|
|
|
|
{
|
|
|
|
|
printf("\t\t\t*****************************************************************\n");
|
|
|
|
|
printf("\t\t\t|\t\t欢迎使用湖南工业大学学生信息管理系统\t\t|\n");
|
|
|
|
|
printf("\t\t\t*****************************************************************\n");
|
|
|
|
|
printf("\t\t\t|\t\t\t请选择功能列表\t\t\t\t|\n");
|
|
|
|
|
printf("\t\t\t|***************************************************************|\n");
|
|
|
|
|
printf("\t\t\t|\t\t\t1.录入学生信息\t\t\t\t|\n");
|
|
|
|
|
printf("\t\t\t|\t\t\t2.打印学生信息\t\t\t\t|\n");
|
|
|
|
|
printf("\t\t\t|\t\t\t3.保存学生信息\t\t\t\t|\n");
|
|
|
|
|
printf("\t\t\t|\t\t\t4.读取学生信息\t\t\t\t|\n");
|
|
|
|
|
printf("\t\t\t|\t\t\t5.查找学生信息\t\t\t\t|\n");
|
|
|
|
|
printf("\t\t\t|\t\t\t6.修改学生信息\t\t\t\t|\n");
|
|
|
|
|
printf("\t\t\t|\t\t\t7.删除学生信息\t\t\t\t|\n");
|
|
|
|
|
printf("\t\t\t|\t\t\t0.退出系统\t\t\t\t|\n");
|
|
|
|
|
printf("\t\t\t*****************************************************************\n");
|
|
|
|
|
|
|
|
|
|
char ch=getch();//从键盘输入一个字符
|
|
|
|
|
switch(ch)
|
|
|
|
|
{
|
|
|
|
|
case '1'://录入学生信息
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
case '2'://打印学生信息
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
case '3'://保存学生信息
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
case '4'://读取学生信息
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case '5'://查找学生信息
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
case '6'://修改学生信息
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
case '0'://退出系统
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
void info_1()
|
|
|
|
|
{
|
|
|
|
|
FILE *fp;
|
|
|
|
|
int s,i,count;
|
|
|
|
|
count=0;
|
|
|
|
|
i=1;
|
|
|
|
|
if((fp=fopen("stu","rb+"))==NULL)
|
|
|
|
|
{
|
|
|
|
|
if((fp=fopen("stu","Wb"))==NULL)
|
|
|
|
|
{
|
|
|
|
|
printf("")
|
|
|
|
|
exit(1);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
stu[0].num=0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
fclose(fp);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|