|
|
|
|
#include <stdio.h>
|
|
|
|
|
#include <windows.h>
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//<2F>ṹ<EFBFBD>嶨<EFBFBD><E5B6A8>
|
|
|
|
|
typedef struct Node{
|
|
|
|
|
int id;//ѧ<><D1A7>
|
|
|
|
|
char name[100];//<2F><>
|
|
|
|
|
char sex[10];//<2F>Ա<EFBFBD>
|
|
|
|
|
int ch,ma,en;//<2F><><EFBFBD><EFBFBD>Ӣ
|
|
|
|
|
int sum;//<2F>ܷ<EFBFBD>
|
|
|
|
|
|
|
|
|
|
//ָ<><D6B8><EFBFBD><EFBFBD>
|
|
|
|
|
struct Node *next;
|
|
|
|
|
}node;
|
|
|
|
|
|
|
|
|
|
node List;//<2F><><EFBFBD><EFBFBD>
|
|
|
|
|
|
|
|
|
|
//<2F>ļ<EFBFBD><C4BC><EFBFBD>ȡ
|
|
|
|
|
int readFile(node *L);
|
|
|
|
|
|
|
|
|
|
void printfAddStuInfo();//<2F><><EFBFBD><EFBFBD>
|
|
|
|
|
void insertStuInfo(node *L,node e);//<2F><><EFBFBD><EFBFBD>
|
|
|
|
|
|
|
|
|
|
//<2F><>ҳ<EFBFBD><D2B3>--<2D>˵<EFBFBD>
|
|
|
|
|
void welcome();
|
|
|
|
|
//<2F>˳<EFBFBD><CBB3><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
void goodBye();
|
|
|
|
|
//ɾ<><C9BE>ѧ<EFBFBD><D1A7><EFBFBD><EFBFBD>Ϣ
|
|
|
|
|
void deleteStuInfo(node *pr);
|
|
|
|
|
//<2F><>ӡɾ<D3A1><C9BE>ѧ<EFBFBD><D1A7><EFBFBD><EFBFBD>Ϣ
|
|
|
|
|
void printDeleteStuInfo(node *L);
|
|
|
|
|
//<2F><EFBFBD>ѧ<EFBFBD><D1A7><EFBFBD><EFBFBD>Ϣ
|
|
|
|
|
void printFixStuInfo(node *L);
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>в<EFBFBD><D0B2><EFBFBD>
|
|
|
|
|
node * searchStuInfoByName(char name[],node *L);
|
|
|
|
|
//<2F><>ѧ<EFBFBD>Ž<EFBFBD><C5BD>в<EFBFBD><D0B2><EFBFBD>
|
|
|
|
|
node * searchStuInfoById(int id,node *L);
|
|
|
|
|
////<2F><>ѯѧ<D1AF><D1A7><EFBFBD><EFBFBD>Ϣ
|
|
|
|
|
void printSearchStuInfo(node *L);
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>
|
|
|
|
|
int saveFile(node *L);
|
|
|
|
|
//<2F><><EFBFBD>ӹ<EFBFBD><D3B9>ܵ<EFBFBD>ʵ<EFBFBD><CAB5>
|
|
|
|
|
void insertStuInfo(node *L,node e);//<2F><><EFBFBD><EFBFBD>
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD>ѧ<EFBFBD><D1A7><EFBFBD><EFBFBD>Ϣ
|
|
|
|
|
void printAddStuInfo();//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѧ<EFBFBD><D1A7><EFBFBD><EFBFBD>Ϣ
|
|
|
|
|
void printStuInfo(node *L);
|
|
|
|
|
//<2F>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
int readFile(Node *L);
|
|
|
|
|
//ɾ<><C9BE>
|
|
|
|
|
void deletestudentInfo();
|
|
|
|
|
//<2F>˳<EFBFBD>
|
|
|
|
|
void goodBye();
|
|
|
|
|
//<2F><>ѯ
|
|
|
|
|
void searchstudentInfo();
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD>
|
|
|
|
|
void printstudentInfo(node *L);
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD>
|
|
|
|
|
void addstudentInfo(node *L);
|
|
|
|
|
//<2F><>
|
|
|
|
|
void fixstudentInfo(node *L);
|
|
|
|
|
//<2F><>ѯ
|
|
|
|
|
void searchstudentInfo(node *L);
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD>
|
|
|
|
|
void printstudentInfo(node *L);
|
|
|
|
|
//<2F><>
|
|
|
|
|
void goodBye();
|
|
|
|
|
|
|
|
|
|
int main(){
|
|
|
|
|
int choice = 0;
|
|
|
|
|
readFile(&List);
|
|
|
|
|
// scanf("%d",&choice);
|
|
|
|
|
while(true){
|
|
|
|
|
welcome();
|
|
|
|
|
scanf("%d",&choice);
|
|
|
|
|
switch (choice)
|
|
|
|
|
{
|
|
|
|
|
case 1://<2F><><EFBFBD><EFBFBD>
|
|
|
|
|
printAddStuInfo();
|
|
|
|
|
break;
|
|
|
|
|
case 2://ɾ<><C9BE>
|
|
|
|
|
printDeleteStuInfo(&List);
|
|
|
|
|
break;
|
|
|
|
|
case 3://<2F><EFBFBD>
|
|
|
|
|
printFixStuInfo(&List);
|
|
|
|
|
break;
|
|
|
|
|
case 4://<2F><>ѯ
|
|
|
|
|
printSearchStuInfo(&List);
|
|
|
|
|
break;
|
|
|
|
|
case 5://<2F><><EFBFBD><EFBFBD>
|
|
|
|
|
printstudentInfo(&List);
|
|
|
|
|
break;
|
|
|
|
|
case 0://<2F>˳<EFBFBD>
|
|
|
|
|
goodBye();
|
|
|
|
|
break;
|
|
|
|
|
// default:
|
|
|
|
|
// break;
|
|
|
|
|
}
|
|
|
|
|
printf("<EFBFBD>Ƿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>(yse:1/no:0)(1/0)\n");
|
|
|
|
|
scanf("%d",&choice);
|
|
|
|
|
if(choice==0){
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD>˵<EFBFBD>ҳ<EFBFBD><D2B3>
|
|
|
|
|
void welcome(){
|
|
|
|
|
printf("***********************\n");
|
|
|
|
|
printf("*** ѧ<><D1A7><EFBFBD>ɼ<EFBFBD><C9BC><EFBFBD><EFBFBD><EFBFBD>ϵͳ ***\n");
|
|
|
|
|
printf("***<2A><><EFBFBD>ߣ<EFBFBD><DFA3><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>****\n");
|
|
|
|
|
printf("***<2A><><EFBFBD><EFBFBD>ѧ<EFBFBD><D1A7><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>1****\n");
|
|
|
|
|
printf("***ɾ<><C9BE>ѧ<EFBFBD><D1A7><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>2****\n");
|
|
|
|
|
printf("***<2A><EFBFBD>ѧ<EFBFBD><D1A7><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>3****\n");
|
|
|
|
|
printf("***<2A><>ѯѧ<D1AF><D1A7><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>4****\n");
|
|
|
|
|
printf("***<2A><><EFBFBD><EFBFBD>ѧ<EFBFBD><D1A7><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>5****\n");
|
|
|
|
|
printf("***<2A>˳<EFBFBD><CBB3><EFBFBD><EFBFBD><EFBFBD>ϵͳ<CFB5><CDB3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>0****\n");
|
|
|
|
|
printf("**<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD>(0-5)***\n");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
////<2F><><EFBFBD><EFBFBD>
|
|
|
|
|
//void addstudentInfo(){
|
|
|
|
|
// printf("----<2D><><EFBFBD><EFBFBD>ѧ<EFBFBD><D1A7><EFBFBD><EFBFBD>Ϣ\n");
|
|
|
|
|
//}
|
|
|
|
|
////ɾ<><C9BE>
|
|
|
|
|
//void deletestudentInfo(){
|
|
|
|
|
// printf("----ɾ<><C9BE>ѧ<EFBFBD><D1A7><EFBFBD><EFBFBD>Ϣ\n");
|
|
|
|
|
//}
|
|
|
|
|
////<2F><><EFBFBD><EFBFBD>
|
|
|
|
|
//void fixstudentInfo(){
|
|
|
|
|
// printf("----<2D><EFBFBD>ѧ<EFBFBD><D1A7><EFBFBD><EFBFBD>Ϣ\n");
|
|
|
|
|
//}
|
|
|
|
|
////<2F><>ѯ
|
|
|
|
|
//void searchstudentInfo(){
|
|
|
|
|
// printf("----<2D><>ѯѧ<D1AF><D1A7><EFBFBD><EFBFBD>Ϣ\n");
|
|
|
|
|
//}
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD>
|
|
|
|
|
void printstudentInfo(node *L){
|
|
|
|
|
// printf("----<2D><><EFBFBD><EFBFBD>ѧ<EFBFBD><D1A7><EFBFBD><EFBFBD>Ϣ\n");
|
|
|
|
|
system("cls");
|
|
|
|
|
node *p = L->next;
|
|
|
|
|
printf("_______________________________________________________");
|
|
|
|
|
printf("|ѧ <20><>\t|<7C><><EFBFBD><EFBFBD>\t|<7C>Ա<EFBFBD>\t|<7C><><EFBFBD><EFBFBD>\t|<7C><>ѧ\t|Ӣ<><D3A2>\t|<7C>ܷ<EFBFBD>\t|\n");
|
|
|
|
|
printf("_______________________________________________________");
|
|
|
|
|
if(p!=NULL){
|
|
|
|
|
while(p!=NULL){
|
|
|
|
|
printf("%d%s\t|%s\t|%d\t|%d\t|%d\t|%d",p->id,p->name,p->sex,p->ch,p->ma,p->en,p->sum);
|
|
|
|
|
printf("______________________________________________________");
|
|
|
|
|
p=p->next;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//<2F>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
int readFile(Node *L){
|
|
|
|
|
FILE *fpr=fopen("studentInfo.txt","r");
|
|
|
|
|
node st;
|
|
|
|
|
node *s;
|
|
|
|
|
node *t=L;
|
|
|
|
|
|
|
|
|
|
if(fpr==NULL){
|
|
|
|
|
return 0;
|
|
|
|
|
}else{
|
|
|
|
|
while(fscanf(fpr,"%d %s %s %d %d %d %d\n",&st.id,st.name,st.sex,&st.ch,&st.ma,&st.en,&st.sum)!=EOF){
|
|
|
|
|
s=(node *)malloc(sizeof(node));
|
|
|
|
|
*s = st;
|
|
|
|
|
|
|
|
|
|
t->next=s;
|
|
|
|
|
t=s;
|
|
|
|
|
t->next=NULL;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
fclose(fpr);
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѧ<EFBFBD><D1A7><EFBFBD><EFBFBD>Ϣ
|
|
|
|
|
void printStuInfo(node *L){
|
|
|
|
|
system("cls");
|
|
|
|
|
node *p=L->next;
|
|
|
|
|
printf("________________________________________________________\n");
|
|
|
|
|
printf("|ѧ<><D1A7>\t|<7C><><EFBFBD><EFBFBD>\t|<7C>Ա<EFBFBD>\t|<7C><><EFBFBD><EFBFBD>\t|<7C><>ѧ\t|Ӣ<><D3A2>\t|<7C>ܷ<EFBFBD>\t|\n");
|
|
|
|
|
printf("________________________________________________________\n");
|
|
|
|
|
if(p!=NULL){
|
|
|
|
|
|
|
|
|
|
while(p!=NULL){
|
|
|
|
|
printf("%d|%s\t|%s\t|%d\t|%d\t|%d\t|%d\t|\n",p->id,p->name,p->sex,p->ch,p->ma,p->en,p->sum);
|
|
|
|
|
printf("________________________________________________________\n");
|
|
|
|
|
p=p->next;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD>ѧ<EFBFBD><D1A7><EFBFBD><EFBFBD>Ϣ
|
|
|
|
|
void printAddStuInfo(){
|
|
|
|
|
//
|
|
|
|
|
system("cls");
|
|
|
|
|
node st;
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѧ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ\n");
|
|
|
|
|
printf("ѧ<EFBFBD><EFBFBD>:");
|
|
|
|
|
scanf("%d",&st.id);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
scanf("%s",st.name);
|
|
|
|
|
printf("<EFBFBD>Ա<EFBFBD>:");
|
|
|
|
|
scanf("%s",st.sex);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:");
|
|
|
|
|
scanf("%d",&st.ch);
|
|
|
|
|
printf("<EFBFBD><EFBFBD>ѧ:");
|
|
|
|
|
scanf("%d",&st.ma);
|
|
|
|
|
printf("Ӣ<EFBFBD><EFBFBD>:");
|
|
|
|
|
scanf("%d",&st.en);
|
|
|
|
|
st.sum=st.ch+st.ma+st.en;
|
|
|
|
|
|
|
|
|
|
insertStuInfo(&List,st);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>
|
|
|
|
|
int saveFile(node *L){
|
|
|
|
|
FILE *fpw=fopen("studentInfo.txt","w");
|
|
|
|
|
if(fpw==NULL) return 0;
|
|
|
|
|
node *p=L->next;
|
|
|
|
|
while(p!=NULL){
|
|
|
|
|
fprintf(fpw,"%d %s %s %d %d %d %d\n",p->id,p->name,p->sex,p->ch,p->ma,p->en,p->sum);
|
|
|
|
|
p=p->next;
|
|
|
|
|
}
|
|
|
|
|
fclose(fpw);//<2F>ر<EFBFBD><D8B1>ļ<EFBFBD>ָ<EFBFBD><D6B8>
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD>ѧ<EFBFBD><D1A7><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD>ӹ<EFBFBD><D3B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD>ݵı<DDB5><C4B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
void insertStuInfo(node *L,node e){
|
|
|
|
|
//ͷ<>巨
|
|
|
|
|
node *h=L;
|
|
|
|
|
node *s=(node *)malloc(sizeof(node));
|
|
|
|
|
*s=e;
|
|
|
|
|
|
|
|
|
|
s->next=h->next;
|
|
|
|
|
h->next=s;
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>
|
|
|
|
|
saveFile(L);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
////<2F><>ѯѧ<D1AF><D1A7><EFBFBD><EFBFBD>Ϣ
|
|
|
|
|
void printSearchStuInfo(node *L){
|
|
|
|
|
system("cls");
|
|
|
|
|
int choice=0;
|
|
|
|
|
int id;
|
|
|
|
|
char name[50];
|
|
|
|
|
node *st;
|
|
|
|
|
printf("<EFBFBD><EFBFBD>ѧ<EFBFBD>Ų<EFBFBD>ѯ----- 1\n");
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѯ----- 2\n");
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѯ<EFBFBD><EFBFBD>ʽ<EFBFBD><EFBFBD>");
|
|
|
|
|
scanf("%d",&choice);
|
|
|
|
|
|
|
|
|
|
if(choice == 1){
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD>ѯ<EFBFBD><EFBFBD>ѧ<EFBFBD>ţ<EFBFBD>");
|
|
|
|
|
scanf("%d",&id);
|
|
|
|
|
st=searchStuInfoById(id,L);
|
|
|
|
|
|
|
|
|
|
if(st==NULL){
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˣ<EFBFBD>\n");
|
|
|
|
|
}else{
|
|
|
|
|
st=st->next;
|
|
|
|
|
printf("________________________________________________________\n");
|
|
|
|
|
printf("|ѧ<><D1A7>\t|<7C><><EFBFBD><EFBFBD>\t|<7C>Ա<EFBFBD>\t|<7C><><EFBFBD><EFBFBD>\t|<7C><>ѧ\t|Ӣ<><D3A2>\t|<7C>ܷ<EFBFBD>\t|\n");
|
|
|
|
|
printf("________________________________________________________\n");
|
|
|
|
|
printf("%d|%s\t|%s\t|%d\t|%d\t|%d\t|%d\t|\n",st->id,st->name,st->sex,st->ch,st->ma,st->en,st->sum);
|
|
|
|
|
printf("________________________________________________________\n");
|
|
|
|
|
}
|
|
|
|
|
}else if(choice ==2){
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD>ѯ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
scanf("%s",name);
|
|
|
|
|
st=searchStuInfoByName(name,L);
|
|
|
|
|
|
|
|
|
|
if(st==NULL){
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˣ<EFBFBD>\n");
|
|
|
|
|
}else{
|
|
|
|
|
st=st->next;
|
|
|
|
|
printf("________________________________________________________\n");
|
|
|
|
|
printf("|ѧ<><D1A7>\t|<7C><><EFBFBD><EFBFBD>\t|<7C>Ա<EFBFBD>\t|<7C><><EFBFBD><EFBFBD>\t|<7C><>ѧ\t|Ӣ<><D3A2>\t|<7C>ܷ<EFBFBD>\t|\n");
|
|
|
|
|
printf("________________________________________________________\n");
|
|
|
|
|
printf("%d|%s\t|%s\t|%d\t|%d\t|%d\t|%d\t|\n",st->id,st->name,st->sex,st->ch,st->ma,st->en,st->sum);
|
|
|
|
|
printf("________________________________________________________\n");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//<2F><>ѧ<EFBFBD>Ž<EFBFBD><C5BD>в<EFBFBD><D0B2><EFBFBD>
|
|
|
|
|
node * searchStuInfoById(int id,node *L){
|
|
|
|
|
|
|
|
|
|
node *p=L;
|
|
|
|
|
|
|
|
|
|
while(p->next!=NULL){
|
|
|
|
|
|
|
|
|
|
if(p->next->id==id){
|
|
|
|
|
return p;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
p=p->next;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>в<EFBFBD><D0B2><EFBFBD>
|
|
|
|
|
node * searchStuInfoByName(char name[],node *L){
|
|
|
|
|
node *p=L;
|
|
|
|
|
|
|
|
|
|
while(p->next!=NULL){
|
|
|
|
|
|
|
|
|
|
if(strcmp(name,p->next->name)==0){
|
|
|
|
|
return p;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
p=p->next;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//<2F><EFBFBD>ѧ<EFBFBD><D1A7><EFBFBD><EFBFBD>Ϣ
|
|
|
|
|
void printFixStuInfo(node *L){
|
|
|
|
|
system("cls");
|
|
|
|
|
int id;
|
|
|
|
|
int choice=-1;
|
|
|
|
|
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD><EFBFBD>ҵ<EFBFBD>ѧ<EFBFBD><EFBFBD>ѧ<EFBFBD><EFBFBD>");
|
|
|
|
|
scanf("%d",&id);
|
|
|
|
|
node *st=searchStuInfoById(id,L);
|
|
|
|
|
|
|
|
|
|
if(st==NULL){
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˣ<EFBFBD>");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
st=st->next;
|
|
|
|
|
|
|
|
|
|
while(1){
|
|
|
|
|
system("cls");
|
|
|
|
|
printf("________________________________________________________\n");
|
|
|
|
|
printf("|ѧ<><D1A7>\t|<7C><><EFBFBD><EFBFBD>\t|<7C>Ա<EFBFBD>\t|<7C><><EFBFBD><EFBFBD>\t|<7C><>ѧ\t|Ӣ<><D3A2>\t|<7C>ܷ<EFBFBD>\t|\n");
|
|
|
|
|
printf("________________________________________________________\n");
|
|
|
|
|
printf("%d|%s\t|%s\t|%d\t|%d\t|%d\t|%d\t|\n",st->id,st->name,st->sex,st->ch,st->ma,st->en,st->sum);
|
|
|
|
|
printf("________________________________________________________\n");
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>---- 1\n");
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD>Ա<EFBFBD>---- 2\n");
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>---- 3\n");
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѧ---- 4\n");
|
|
|
|
|
printf("<EFBFBD><EFBFBD>Ӣ<EFBFBD><EFBFBD>---- 5\n");
|
|
|
|
|
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD>ĵ<EFBFBD><EFBFBD><EFBFBD>Ϣ: ");
|
|
|
|
|
scanf("%d",&choice);
|
|
|
|
|
|
|
|
|
|
switch(choice){
|
|
|
|
|
case 1:
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
scanf("%s",st->name);
|
|
|
|
|
break;
|
|
|
|
|
case 2:
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ա<EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
scanf("%s",st->sex);
|
|
|
|
|
break;
|
|
|
|
|
case 3:
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģ<EFBFBD>");
|
|
|
|
|
scanf("%d",&st->ch);
|
|
|
|
|
break;
|
|
|
|
|
case 4:
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѧ<EFBFBD><EFBFBD>");
|
|
|
|
|
scanf("%d",&st->ma);
|
|
|
|
|
break;
|
|
|
|
|
case 5:
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӣ<EFBFBD>");
|
|
|
|
|
scanf("%d",&st->en);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
st->sum=st->ch+st->ma+st->en;
|
|
|
|
|
printf("<EFBFBD>Ƿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѧ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ?<3F><>y-1 / n-0<><30>\n");
|
|
|
|
|
scanf("%d",&choice);
|
|
|
|
|
if(choice == 0){
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
printf("________________________________________________________\n");
|
|
|
|
|
printf("|ѧ<><D1A7>\t|<7C><><EFBFBD><EFBFBD>\t|<7C>Ա<EFBFBD>\t|<7C><><EFBFBD><EFBFBD>\t|<7C><>ѧ\t|Ӣ<><D3A2>\t|<7C>ܷ<EFBFBD>\t|\n");
|
|
|
|
|
printf("________________________________________________________\n");
|
|
|
|
|
printf("%d|%s\t|%s\t|%d\t|%d\t|%d\t|%d\t|\n",st->id,st->name,st->sex,st->ch,st->ma,st->en,st->sum);
|
|
|
|
|
printf("________________________________________________________\n");
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>Ϣ
|
|
|
|
|
saveFile(L);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//<2F><>ӡɾ<D3A1><C9BE>ѧ<EFBFBD><D1A7><EFBFBD><EFBFBD>Ϣ
|
|
|
|
|
void printDeleteStuInfo(node *L){
|
|
|
|
|
system("cls");
|
|
|
|
|
int id;
|
|
|
|
|
|
|
|
|
|
node *p;
|
|
|
|
|
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD><EFBFBD>ҵ<EFBFBD>ѧ<EFBFBD><EFBFBD>ѧ<EFBFBD><EFBFBD>");
|
|
|
|
|
scanf("%d",&id);
|
|
|
|
|
node *st=searchStuInfoById(id,L);
|
|
|
|
|
p=st;
|
|
|
|
|
|
|
|
|
|
if(st==NULL){
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˣ<EFBFBD>");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
st=st->next;
|
|
|
|
|
printf("________________________________________________________\n");
|
|
|
|
|
printf("|ѧ<><D1A7>\t|<7C><><EFBFBD><EFBFBD>\t|<7C>Ա<EFBFBD>\t|<7C><><EFBFBD><EFBFBD>\t|<7C><>ѧ\t|Ӣ<><D3A2>\t|<7C>ܷ<EFBFBD>\t|\n");
|
|
|
|
|
printf("________________________________________________________\n");
|
|
|
|
|
printf("%d|%s\t|%s\t|%d\t|%d\t|%d\t|%d\t|\n",st->id,st->name,st->sex,st->ch,st->ma,st->en,st->sum);
|
|
|
|
|
printf("________________________________________________________\n");
|
|
|
|
|
|
|
|
|
|
deleteStuInfo(p);
|
|
|
|
|
saveFile(L);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
//ɾ<><C9BE>ѧ<EFBFBD><D1A7><EFBFBD><EFBFBD>Ϣ
|
|
|
|
|
void deleteStuInfo(node *pr){
|
|
|
|
|
node *s=pr->next;
|
|
|
|
|
|
|
|
|
|
pr->next=s->next;
|
|
|
|
|
s->next=NULL;
|
|
|
|
|
|
|
|
|
|
free(s);//<2F>ͷŽ<CDB7><C5BD><EFBFBD><EFBFBD>ռ<EFBFBD>
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//<2F>˳<EFBFBD><CBB3><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
void goodBye(){
|
|
|
|
|
system("cls");
|
|
|
|
|
printf("<EFBFBD><EFBFBD>ӭ<EFBFBD>´<EFBFBD>ʹ<EFBFBD><EFBFBD>~\n");
|
|
|
|
|
exit(0);//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
}
|