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