You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
lzlzlz/学生信息管理函数完整版.c

54 lines
1.4 KiB

#include"删除函数和保存函数.c"
void modify()/*修改函数*/
{
int num,j,i;
char s1[LEN+1],s2[LEN+1];/*用于存放新的学生信息*/
loop:printf("请输入要修改学生的学号:");
scanf("%s",s1);
for(i=0;i<n;i++)
if(strcmp(stu[i].id,s1)==0)
num=i;
else
{
printf("该学号不存在\n\n");
goto loop;/*返回到重新输入学号*/
}
printf("------------------\n");
printf("1.修改姓名\n");
printf("2.修改年龄\n");
printf("3.修改性别\n");
printf("4.修改出生年月\n");
printf("5.修改地址\n");
printf("6.修改电话号码\n");
printf("7.修改E-mail地址\n");
printf("8.退出本菜单\n");
printf("------------------\n");
printf("请选择需要的功能编号:");
scanf("%d",&j);
switch(j)
{
case 1: printf("请输入新的姓名:");
scanf("%s",s2);
strcpy(stu[num].name,s2);break;
case 2: printf("请输入新的年龄:");
scanf("%d",&stu[num].age);break;
case 3: printf("请输入新的性别:");
scanf("%s",s2);
strcpy(stu[num].sex,s2);break;
case 4: printf("请输入新的出生年月:");
scanf("%s",s2);
strcpy(stu[num].birth,s2);break;
case 5: printf("请输入新的地址:");
scanf("%s",s2);
strcpy(stu[num].add,s2);break;
case 6: printf("请输入新的电话号码:");
scanf("%s",s2);
strcpy(stu[num].tel,s2);break;
case 7: printf("请输入新的邮件地址:");
scanf("%s",s2);
strcpy(stu[num].email,s2);break;
case 8: return;
default: printf("请在1-8中进行选择\n");
}
}