学生管理系统 就差修改模块了 ~~~~
new新代码.rar
(1.94 KB)
就要完工了,,,可修改模块 没起到修改的作用 ,,,还望各路大虾 帮忙啊~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
下面是已有的修改模块 具体见附件
/*定义修改数据的学生学籍管理系统的函数*/
void modify()
{
int k=0;
long offset;
char numkey[15];
struct person one ;
printf("\nPlease enter the number you want to modify school students:");
scanf("%s",numkey);
if((fp=fopen("student.txt","r+"))==NULL)
{
printf("\nCan not establish a Student Information Management System");
exit(0);
}
rewind(fp);
while(!feof(fp))
{ offset=ftell(fp);
fscanf(fp,"%s%s%s%s%s%s%s%s",one.name,one.st_num,one.sex,one.born_ym,one.major,one.class_num,one.address,one.hostelnum);
if(!strcmp(numkey,one.st_num))
{
printf("\n\nHas been found, record:");
printf("\n\nname st_num sex born_ym major class address hostelnum\n");
printf("%-10s%-10s%-10s%-10s%-10s%-10s%-10s%-10sn",one.name,one.st_num,one.sex,one.born_ym,one.major,one.class_num,one.address,one.hostelnum);
k=1;
}
}
if(k)
{
printf("\nPlease enter a new student record:\n");
scanf("%s%s%s%s%s%s%s",one.st_num,one.sex,one.born_ym,one.major,one.class_num,one.address,one.hostelnum);
fseek(fp,offset,SEEK_SET);
fprintf(fp,"%-10s%-10s%-10s%-10s%-10s%-10s%-10s%-10sn",one.name,one.st_num,one.sex,one.born_ym,one.major,one.class_num,one.address,one.hostelnum);
}
else
printf("\nSorry, no records。");
fclose(fp);
system("cls");
}
[ 本帖最后由 zdoublehang 于 2010-6-6 17:04 编辑 ]