|
|
|
@ -189,5 +189,162 @@ void notice() {//
|
|
|
|
|
GREEN();
|
|
|
|
|
printf("请键入:");
|
|
|
|
|
}
|
|
|
|
|
//11111111111
|
|
|
|
|
void case1() {//学生综合信息录入
|
|
|
|
|
int flag;
|
|
|
|
|
flag=1;
|
|
|
|
|
while(flag) {
|
|
|
|
|
entry();
|
|
|
|
|
LIGHT();
|
|
|
|
|
printf("提示:1,继续录入;0,录入完成.是否继续录入:");
|
|
|
|
|
GREEN();
|
|
|
|
|
scanf("%d",&flag);
|
|
|
|
|
i_entry++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
void entry() {//学生信息的录入
|
|
|
|
|
int flag,i;
|
|
|
|
|
system("cls");
|
|
|
|
|
init();
|
|
|
|
|
flag=1;
|
|
|
|
|
puts("***************>>>>>>当前模式为学生信息录入状态<<<<<<*************");
|
|
|
|
|
printf("请输入学生学号:");
|
|
|
|
|
flag=1;//标识变量,用以判断该信息是否已存在
|
|
|
|
|
scanf("%s",&DATA[i_entry].stuid);
|
|
|
|
|
for(i=0; i<i_entry; i++) //判断输入数据的正误,即文件中是否已存在该信息
|
|
|
|
|
if(strcmp(DATA[i].stuid,DATA[i_entry].stuid)==0) {
|
|
|
|
|
flag=0;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
if(flag==1) {
|
|
|
|
|
printf("请输入学生姓名:");
|
|
|
|
|
scanf("%s",DATA[i_entry].name);
|
|
|
|
|
printf("请输入学生年龄:");
|
|
|
|
|
scanf("%s",DATA[i_entry].age);
|
|
|
|
|
printf("请输入学生性别:");
|
|
|
|
|
scanf("%s",DATA[i_entry].gender);
|
|
|
|
|
printf("请输入学生出生年月日(以/隔开):");
|
|
|
|
|
scanf("%s",DATA[i_entry].birth);
|
|
|
|
|
printf("请输入学生联系地址:");
|
|
|
|
|
scanf("%s",DATA[i_entry].add);
|
|
|
|
|
printf("请输入学生联系电话:");
|
|
|
|
|
scanf("%s",DATA[i_entry].tle);
|
|
|
|
|
printf("请输入学生联系邮箱:");
|
|
|
|
|
scanf("%s",DATA[i_entry].email);
|
|
|
|
|
file_save();
|
|
|
|
|
}
|
|
|
|
|
if(flag==0)
|
|
|
|
|
puts("该学号已经存在,如需修改请转到修改命令!");
|
|
|
|
|
}
|
|
|
|
|
void file_save() {//信息以文件格式录入函数
|
|
|
|
|
fprintf(fp, "%s\t\t%s\t%s\t%s\t%s\t%s\t%s\t%s\n", DATA[i_entry].stuid, DATA[i_entry].name,DATA[i_entry].age,
|
|
|
|
|
DATA[i_entry].gender, DATA[i_entry].birth, DATA[i_entry].add, DATA[i_entry].tle, DATA[i_entry].email);
|
|
|
|
|
printf("保存成功!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//2222222222222
|
|
|
|
|
void case2() {//学生综合信息浏览
|
|
|
|
|
puts("***************>>>>>>当前模式为学生信息浏览状态<<<<<<*************");
|
|
|
|
|
i_printf();
|
|
|
|
|
}
|
|
|
|
|
void i_printf() {//学生信息的输出
|
|
|
|
|
int i,k=1;
|
|
|
|
|
//printf("学号\t姓名\t年龄\t性别\t出生年/月/日\t联系地址\t联系电话\t联系邮箱");
|
|
|
|
|
printf("\n");
|
|
|
|
|
if(k)
|
|
|
|
|
{
|
|
|
|
|
for(i=0; i<i_entry; i++)
|
|
|
|
|
{
|
|
|
|
|
printf("学号:%-18s\n",&DATA[i].stuid);
|
|
|
|
|
printf("姓名:%-16s\n",DATA[i].name);
|
|
|
|
|
printf("年龄:%-4s\n",&DATA[i].age);
|
|
|
|
|
printf("性别:%-6s\n",DATA[i].gender);
|
|
|
|
|
printf("出生年月日:%-12s\n",&DATA[i].birth);
|
|
|
|
|
printf("地址:%-16s\n",DATA[i].add);
|
|
|
|
|
printf("联系方式:%-16s\n",DATA[i].tle);
|
|
|
|
|
printf("邮箱:%-15s\n\n",DATA[i].email);
|
|
|
|
|
}
|
|
|
|
|
LIGHT();
|
|
|
|
|
printf("提示:退出请按0并按回车键。\n");
|
|
|
|
|
scanf("%d",&k);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//44444444444
|
|
|
|
|
void case4() {//学生个人信息查询
|
|
|
|
|
int v;
|
|
|
|
|
LIGHT();
|
|
|
|
|
printf("提示:1,按照学号查询;2,按照姓名查询.请键入:");
|
|
|
|
|
GREEN();
|
|
|
|
|
scanf("%d",&v);
|
|
|
|
|
if(v==1) {
|
|
|
|
|
stuid_find();
|
|
|
|
|
}
|
|
|
|
|
if(v==2) {
|
|
|
|
|
name_find();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
void stuid_find() {//学号查找 利用strcmp()函数
|
|
|
|
|
int i,flag=0,k;
|
|
|
|
|
char wqs[MIN_C];
|
|
|
|
|
k=1;
|
|
|
|
|
system("cls");
|
|
|
|
|
puts("***************>>>>>>当前模式以学号查询信息状态<<<<<<*************");
|
|
|
|
|
while(k) {
|
|
|
|
|
printf("请键入学生学号: ");
|
|
|
|
|
scanf("%s",wqs);
|
|
|
|
|
for(i=0; i<i_entry; i++)
|
|
|
|
|
if(strcmp(DATA[i].stuid,wqs)==0) {
|
|
|
|
|
printf("学号:%-18s\n",&DATA[i].stuid);
|
|
|
|
|
printf("姓名:%-16s\n",DATA[i].name);
|
|
|
|
|
printf("年龄:%-4s\n",&DATA[i].age);
|
|
|
|
|
printf("性别:%-6s\n",DATA[i].gender);
|
|
|
|
|
printf("出生年月日:%-12s\n",&DATA[i].birth);
|
|
|
|
|
printf("地址:%-16s\n",DATA[i].add);
|
|
|
|
|
printf("联系方式:%-16s\n",DATA[i].tle);
|
|
|
|
|
printf("邮箱:%-15s\n",DATA[i].email);
|
|
|
|
|
flag=1;
|
|
|
|
|
}
|
|
|
|
|
if(flag==0)
|
|
|
|
|
puts("未查找到该同学信息,如需录入信息请重新键入命令.");
|
|
|
|
|
LIGHT();
|
|
|
|
|
puts("请按照文字提示键入命令:");
|
|
|
|
|
printf("\t\t1.继续查询\n\t\t0.退出查询\n请键入命令:");
|
|
|
|
|
GREEN();
|
|
|
|
|
scanf("%d",&k);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void name_find() {//姓名查找 利用函数strcmp()==0 的特性
|
|
|
|
|
int i,flag=0,k;
|
|
|
|
|
char wqs[MIN_C];
|
|
|
|
|
k=1;
|
|
|
|
|
system("cls");
|
|
|
|
|
puts("***************>>>>>>当前模式以姓名查询信息状态<<<<<<*************");
|
|
|
|
|
while(k) {
|
|
|
|
|
printf("请键入学生姓名: ");
|
|
|
|
|
scanf("%s",wqs);
|
|
|
|
|
for(i=0; i<i_entry; i++)
|
|
|
|
|
if(strcmp(DATA[i].name,wqs)==0) {
|
|
|
|
|
printf("学号:%-18s\n",&DATA[i].stuid);
|
|
|
|
|
printf("姓名:%-16s\n",DATA[i].name);
|
|
|
|
|
printf("年龄:%-4s\n",&DATA[i].age);
|
|
|
|
|
printf("性别:%-6s\n",DATA[i].gender);
|
|
|
|
|
printf("出生年月日:%-12s\n",&DATA[i].birth);
|
|
|
|
|
printf("地址:%-16s\n",DATA[i].add);
|
|
|
|
|
printf("联系方式:%-16s\n",DATA[i].tle);
|
|
|
|
|
printf("邮箱:%-15s\n",DATA[i].email);
|
|
|
|
|
flag=1;
|
|
|
|
|
}
|
|
|
|
|
if(flag==0)
|
|
|
|
|
puts("未查找到该同学信息,如需录入信息请重新键入命令.");
|
|
|
|
|
LIGHT();
|
|
|
|
|
puts("请按照文字提示键入命令:");
|
|
|
|
|
printf("\t\t1.继续查询\n\t\t0.退出查询\n请键入命令:");
|
|
|
|
|
GREEN();
|
|
|
|
|
scanf("%d",&k);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|