该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
char v;
printf("NO.%d\n",i);
OutputStudentData((stud+i));
printf("\n\nis it(if true,input 0)");
v=getch();
printf("\n");
if(v=='0'){
struct Student c;
c=*(stud+i),*(stud+i)=*(stud+number-1),*(stud+number-1)=c;
number--;
CorrectOrder(stud,number);
if(!OutputDataToFile(stud,&number))printf("write error!!");
}
}
}
}
else printf("read error!!");
getch();
}
void MAKEROVER(){ //更改学生质料
FILE *fn,*fs;
if((fn = fopen("number.dat","rd") )&&
(fs = fopen("studentdata.dat","rd") )){
int i,j,number;
fread(&number,sizeof(number),1,fn);
fclose(fn);
struct Student stud[number];
fread(stud,sizeof(struct Student),number,fs);
fclose(fs);
char a[30];
while(printf("Input name:(if input 0,to end)")&&
scanf("%s",a)&&strcmp(a,"0")!=0){
for(i = 0;i
if(strcmp(stud[i].name,a)==0){
char v;
printf("NO.%d\n",i);
OutputStudentData((stud+i));
printf("\n\nis it(if true,input 0)");
v=getch();
printf("\n");
if(v=='0'){
InputStudentData((stud+i));
CorrectOrder(stud,number);
if(!OutputDataToFile(stud,&number))printf("write error!!");
}
}
}
}
else printf("read error!!");
getch();
}
void _(){
system("cls");
printf("----------------------------------------------------------------\n");
printf(" student manage system\n");
printf("----------------------------------------------------------------\n");
printf(" if input 0 to end\n");
printf(" if input 1 to add data\n");
printf(" if input 2 to see data\n");
printf(" if input 3 to all show\n");
printf(" if input 4 to delete\n");
printf(" if input 5 to maker over\n");
printf("----------------------------------------------------------------\n");
}
int main(void){
char key;
while(2){
_();
key=getche();
printf("\n");
if(key== '0')break;
if(key== '1')ADD();
if(key== '2')SEE();
if(key== '3')ALLSHOW();
if(key== '4')DELETE();
if(key== '5')MAKEROVER();
}
return 0;
}