⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 taokeguanlixitong.txt

📁 逃课管理系统!哈哈
💻 TXT
📖 第 1 页 / 共 3 页
字号:
 system("cls"); 
 return ; 
 } 
 printf("输入有误,请返回重新选择!"); 
 free(tempname); 
 free(tempbirth); 
 getch(); 
 system("cls"); 
 return ; 
} 
/***********************修改旷课科目*********************/ 
void mofaddr(struct allstudentinfo *p_student) 
{ char *tempname; 
 char *tempaddr; 
 char ch; 
 
 
  
   
 

 
  
  int i,count; 
 system("cls"); 
 count=datfile(p_student); //处理文件 
 if(!count) 
 { printf("读取数据失败,请确认已成功录入或数据是否损坏!"); 
 getch(); 
 return ; } 
 tempname=(char *)malloc(20*sizeof(char)); 
 tempaddr=(char *)malloc(20*sizeof(char)); //分配内存 
 printf("请输入要修改的学生姓名:"); 
 while(gets(tempname)!=NULL&&tempname[0]!='\0') 
 { for(i=0;i<count;i++) 
 { if(strcmp(tempname,p_student[i].student.name)) 
 continue; 
 else 
 { printf("请重新输入该学生的旷课科目:"); 
 gets(tempaddr); 
 system("cls"); 
 printf("\a\n\n\n\n\t\t\t确定要修改%s的旷课科目吗?(y/n)",tempname); 
 ch=getch(); 
 if(ch=='y'||ch=='Y') 
 { strcpy(p_student[i].student.addr,tempaddr); 
 infofile=fopen(filename,"w+b"); //重新写入数据库  
 for(i=0;i<count;i++) 
 { if(fwrite(&p_student[i].student,sizeof(struct studentinfo),1,infofile)==1) 
 continue; 
 else 
 { fclose(infofile); 
 free(tempname); 
 free(tempaddr); 
 system("cls"); 
 printf("\n\n\n\n\t\t\t修改失败,返回......!"); 
 getch(); 
 system("cls"); 
 return ; } 
 } 
 fclose(infofile); 
 system("cls"); 
 printf("\n\n\n\n\t\t\t成功修改%s的旷课科目,返回......!,",tempname); 
 free(tempname); 
 free(tempaddr); 
 getch(); 
 system("cls"); 
 return ; 
 } 
 printf("\n\n\n\n\t\t\t该操作已被取消,返回.......!"); 
 free(tempname); 
 free(tempaddr); 
 getch(); 
 system("cls"); 
 return ; 
 } 
 } 
 printf("\n\n\n\n\t\t\t找不到%s的个人信息,返回.......!",tempname); 
 free(tempname); 
 free(tempaddr); 
 getch(); 
 system("cls"); 
 return ; 
 } 
 printf("输入有误,请返回重新选择.......!"); 
 free(tempname); 
 free(tempaddr); 
 getch(); 
 system("cls"); 
 return ; 
} 
/*****************************修改学生学号********************************/ 
void moftel(struct allstudentinfo *p_student) 
{ char *tempname; 
 char *temptel; 
 char ch; 
 int i,count; 
 system("cls"); 
 count=datfile(p_student); //处理文件 
 if(!count) 
 { printf("读取数据失败,请确认已成功录入或数据是否损坏!"); 
 getch(); 
 system("cls"); 
 return ; 
 } 
 tempname=(char *)malloc(20*sizeof(char)); 
 temptel=(char *)malloc(20*sizeof(char)); //分配内存 
 printf("请输入要修改的学生姓名:"); 
 while(gets(tempname)!=NULL&&tempname[0]!='\0') 
 { for(i=0;i<count;i++) 
 { 
 if(strcmp(tempname,p_student[i].student.name)) 
 continue; 
 else 
 { printf("请重新输入该学生的学生学号:"); 
 gets(temptel); 
 system("cls"); 
 printf("\a\n\n\n\n\t\t\t确定要修改%s的学生学号吗?(y/n)",tempname); 
 ch=getch(); 
 if(ch=='y'||ch=='Y') 
 { strcpy(p_student[i].student.number,temptel); 
 infofile=fopen(filename,"w+b"); 
 for(i=0;i<count;i++) 
 { if(fwrite(&p_student[i].student,sizeof(struct studentinfo),1,infofile)==1) 
 continue; 
 else 
 { fclose(infofile); 
 free(tempname); 
 free(temptel); 
 system("cls"); 
 printf("\n\n\n\n\t\t\t修改失败,返回.......!"); 
 getch(); 
 system("cls"); 
 return ; } 
 } 
 fclose(infofile); 
 system("cls"); 
 printf("\n\n\n\n\t\t\t成功修改%s的学生学号,返回.......!,",tempname); 
 free(tempname); 
 free(temptel); 
 getch(); 
 system("cls"); 
 return ; 
 } 
 printf("\n\n\n\n\t\t\t该操作已被取消,返回.......!"); 
 free(tempname); 
 
 
  
  
 

 
  
  free(temptel); 
 getch(); 
 system("cls"); 
 return ; 
 } 
 } 
 printf("\n\n\n\n\t\t\t找不到%s的个人信息,返回.......!",tempname); 
 free(tempname); 
 free(temptel); 
 getch(); 
 system("cls"); 
 return ; 
 } 
 printf("输入有误,请返回重新选择.......!"); 
 free(tempname); 
 free(temptel); 
 getch(); 
 system("cls"); 
 return ; 
} 
/**************************修改旷课数目*************************/ 
void mofdak(struct allstudentinfo *p_student) 
{ char *tempname; 
 char *tempdak; 
 char ch; 
 int i,count; 
 system("cls"); 
 count=datfile(p_student); //处理文件  
 if(!count) 
 { printf("读取数据失败,请确认已成功录入或数据是否损坏!"); 
 getch(); 
 system("cls"); 
 return ; } 
 tempname=(char *)malloc(20*sizeof(char)); 
 tempdak =(char *)malloc(20*sizeof(char)); //分配内存 
 printf("请输入要修改的学生姓名:"); 
 while(gets(tempname)!=NULL&&tempname[0]!='\0') 
 { for(i=0;i<count;i++) 
 { if(strcmp(tempname,p_student[i].student.name)) 
 continue; 
 else 
 { printf("请重新输入该学生的旷课数目:"); 
 gets(tempdak); 
 system("cls"); 
 printf("\a\n\n\n\n\t\t\t确定要修改%s的旷课数目吗?(y/n)",tempname); 
 ch=getch(); 
 if(ch=='y'||ch=='Y') 
 { strcpy(p_student[i].student.dak,tempdak); 
 infofile=fopen(filename,"w+b"); 
 for(i=0;i<count;i++) 
 { if(fwrite(&p_student[i].student,sizeof(struct studentinfo),1,infofile)==1) 
 continue; 
 else 
 { fclose(infofile); 
 free(tempname); 
 free(tempdak); 
 system("cls"); 
 printf("\n\n\n\n\t\t\t修改失败,返回.......!"); 
 getch(); 
 system("cls"); 
 return ; } 
 } 
 fclose(infofile); 
 system("cls"); 
 printf("\n\n\n\n\t\t\t成功修改%s的旷课数目,返回.......!",tempname); 
 free(tempname); 
 free(tempdak); 
 getch(); 
 system("cls"); 
 return ; } 
 printf("\n\n\n\n\t\t\t该操作已取消,返回.......!"); 
 free(tempname); 
 free(tempdak); 
 getch(); 
 system("cls"); 
 return ; } } 
 printf("\n\n\n\n\t\t\t找不到%s的个人信息,返回.......!",tempname); 
 free(tempname); 
 free(tempdak); 
 getch(); 
 system("cls"); 
 return ; } 
 printf("输入有误,请返回重新选择.......!"); 
 free(tempname); 
 free(tempdak); 
 getch(); 
 system("cls"); 
 return ; } 
/*************************修改所在班级******************************/ 
void mofschool(struct allstudentinfo *p_student) 
{ char *tempname; 
 char *tempschool; 
 char ch; 
 int i,count; 
 system("cls"); 
 count=datfile(p_student); //文件处理  
 if(!count) 
 { printf("读取数据失败,请确认已成功录入或数据是否损坏!"); 
 getch(); 
 system("cls"); 
 return ; 
 }  
 tempname=(char *)malloc(20*sizeof(char)); 
 tempschool=(char *)malloc(20*sizeof(char)); //分配内存 
 printf("请输入要修改的学生姓名:"); 
 while(gets(tempname)!=NULL&&tempname[0]!='\0') 
 { for(i=0;i<count;i++) 
 { if(strcmp(tempname,p_student[i].student.name)) 
 continue; 
 else 
 { printf("请重新输入该学生的所在班级:"); 
 gets(tempschool); 
 system("cls"); 
 printf("\a\n\n\n\n\t\t\t确定要修改%s的所在班级吗?(y/n)",tempname); 
 ch=getch(); 
 if(ch=='y'||ch=='Y') 
 { strcpy(p_student[i].student.school,tempschool); 
 infofile=fopen(filename,"w+b"); 
 for(i=0;i<count;i++) 
 { if(fwrite(&p_student[i].student,sizeof(struct studentinfo),1,infofile)==1) 
 
 
    
 

 
 
  continue; 
 else 
 { fclose(infofile); 
 free(tempname); 
 free(tempschool); 
 system("cls"); 
 printf("\n\n\n\n\t\t\t修改失败,返回.......!"); 
 getch(); 
 system("cls"); 
 return ; } } 
 fclose(infofile); 
 system("cls"); 
 printf("\n\n\n\n\t\t\t成功修改%s的所在班级,返回.......!",tempname); 
 free(tempname); 
 free(tempschool); 
 getch(); 
 system("cls"); 
 return ; } 
 printf("\n\n\n\n\t\t\t该操作已取消,返回.......!"); 
 free(tempname); 
 free(tempschool); 
 getch(); 
 system("cls"); 
 return ; } } 
 printf("\n\n\n\n\t\t\t找不到%s的个人信息,返回.......!",tempname); 
 free(tempname); 
 free(tempschool); 
 getch(); 
 system("cls"); 
 return ; } 
 printf("输入有误,请返回重新选择.......!"); 
 free(tempname); 
 free(tempschool); 
 getch(); 
 system("cls"); 
 return ; } 
/**************************修改个人信息的主要操作文件**************************/ 
int datfile(struct allstudentinfo *p_student) 
{ int count; 
  
 system("cls"); 
 if((infofile=fopen(filename,"rb"))==NULL) 
 { printf("不能找开文件,请确认磁盘已满或文件是否存在!"); 
 getch(); 
 exit(1); } 
 rewind(infofile); //指向文件头读取数据  
 for(count=0;fread(&p_student[count].student,sizeof(struct studentinfo),1,infofile)==1;count++) 
 { continue; } 
 fclose(infofile); 
 return count; //返回读到的结构块数  
}  
/*****************************系统帮助信息*******************************/ 
void systemhelp() 
{ system("cls"); 
 printf("\n\n\n\t\t\t\t系统帮助\n"); 
 printf("\t****************------------------------------******************\n"); 
 printf("\t 本系统支持汉字、英语、拼音或其它助记方式录入,为了能正常使用\n"); 
 printf("\t本系统,如要使用修改和删除功能请谨慎使用,或先将资料做好备份以免\n"); 
 printf("\t因系统出错造成数据丢失! 请按任意键退出!\n"); 
 printf("\t****************------------------------------******************\n"); 
 getch(); 
 system("cls"); 
 return ; }  
/***********退出*********************************/ 
void logout() 
{ time_t start,end; //时间函数 
 system("cls"); 
 printf("\n\n\n\n\n\n\n\n\t\t\t"); 
 printf("谢 谢 使 用 本 系 统 !");  
 start=time(NULL); 
 end=time(NULL); 
 while(end-start<2) //延时2秒执行以下程序  
 end=time(NULL); 
 exit(0); 
}  
 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -