📄 教务管理.txt
字号:
scanf("%s",KIND);
if(strcmp(SEX,"Male")!=0||strcmp(SEX,"Famale")!=0)
strcpy(p2->kind,SEX);
else {cprintf("Wrong information!Insert again!");
goto in5;
}
flag=0;
}
if(order==10)
{
cprintf("\t Input %s's new tel:",p2->name);
scanf("%ld",&p2->tel);
flag=0;
}
if(order==11)
{
for(i=0;i<strlen(p2->add);i++)
p2->add[i]=' ';
cprintf("\t Input %s's new address:",p2->name);
scanf("%s",p2->add);
flag=0;
}
if(flag)
{
cprintf("\t Input item error! ");
goto inx;
}
cprintf("SUCESSES!Continue?(y/n)");
while(isspace(ch=getchar()));
}while(ch=='y'||ch=='Y');
inEND: return(headp);
}
struct CLASS * mod_sbj(struct CLASS *headp)/*修改科目信息*/
{
struct CLASS *p1;
struct STUD *p2;
struct SUB *p3;
int order;
char key[12];
int ch, n=0;
int sbj_num,no,flag=1;
long stu_num;
in1:if(n>3) /*连续四次输入错误密码,返回*/
{ cprintf("Too many errors!");
goto inEND;
}
cprintf("\nInput the your keywords:");/*输入学生密码*/
scanf("%s",key);
do{
cprintf("\nInput the class number:");
scanf("%u",&no);
in2:cprintf("\n Input the student number:");
scanf("%ld",&stu_num);
if(((stu_num/100)%100)!=no)
{ cprintf("Wrong numbers!");
goto in2;
}
cprintf("\n Input the subject number:");
scanf("%u",&sbj_num);
for(p1=headp->next;p1!=NULL;p1=p1->next)
{
if(p1->no==no) break; /*找到班级入口*/
else continue;
}
if(p1==NULL){WarnCLA();goto inEND;} /*班级不存在*/
for(p2=p1->first;p2!=NULL;p2=p2->next)
{
if(p2->number!=stu_num)continue;
else break;
} /*找到学生*/
if(p2==NULL){WarnSTU();goto inEND;}
if(strcmp(p2->STUkey,key)) /*验证密码*/
{ cprintf( "Wrong keywords! ");
n++;
goto in1;
}
for(p3=p2->first;p3!=NULL;p3=p3->next)
{
if(p3->number!=sbj_num)continue;
else break;
} /*找到课程入口*/
if(p3==NULL){WarnSUB();goto inEND;} /*课程尚未创建*/
/*输入你要修改的项目*/
cprintf("\n\t student name:%-16s \t subject name:%-13s \t credit:%-10d",p2->name,p3->name,p3->credit);
inx: cprintf("\nInput the item you want to modify ( 1:name ,2:credit ,3:number ):");
scanf("%d",&order);
if(order==1)
{ flag=0;
for(i=0;i<strlen(p3->name);i++)
p3->name[i]=' ';
cprintf("\t Input the new name :");
scanf("%s",p3->name);
}
if(order==2)
{ flag=0;
cprintf("\t Input the new cridit:");
p3->credit=0;
scanf("%u",&p3->credit);
}
if(order==3)
{ flag=0;
cprintf("\t Input the new number:");
p3->number=0;
scanf("%u",&p3->number);
}
if(flag){
cprintf("\t Input item error! ");
goto inx;
}
cprintf("SUCESSES!Continue?(y/n)");
while(isspace(ch=getchar()));
}while(ch=='y'||ch=='Y');
inEND: return(headp);
}
struct CLASS * mod_score(struct CLASS *headp)/*修改科目的成绩*/
{
struct CLASS *p1;
struct STUD *p2;
struct SUB *p3;
int order;
char key[12];
int no,subnum=0;
long stu_num;
int n=0,flag=1,sum=0,credit=0;
in1:if(n>3) /*连续四次输入错误密码*/
{ cprintf("Too many errors!");
goto inEND;
}
cprintf("\nInput the your keywords:");
scanf("%s",key);
cprintf("\n Input the class number:");
scanf("%u",&no);
in2:cprintf("\n Input the student number:");
scanf("%ld",&stu_num);
if(((stu_num/100)%100)!=no)
{ cprintf("Wrong numbers!");
goto in2;
}
cprintf("\n Input the subject number:");
scanf("%d",&subnum);
for(p1=headp->next; p1!=NULL; p1=p1->next)
{
if(p1->no==no) break;/*找到班级入口*/
else continue;
}
if(p1==NULL){WarnCLA();goto inEND;}
for(p2=p1->first; p2!=NULL; p2=p2->next)
{
if(p2->number!=stu_num)continue;
else break;
} /*找到学生*/
if(p2==NULL){WarnSTU();goto inEND;}
if(strcmp(p2->STUkey,key))
{ cprintf( "Wrong keywords! ");
n++;
goto in1;
}
struct CLASS * mod_sbj(struct CLASS *headp)/*修改科目信息*/
{
struct CLASS *p1;
struct STUD *p2;
struct SUB *p3;
int order;
char key[12];
int ch, n=0;
int sbj_num,no,flag=1;
long stu_num;
in1:if(n>3) /*连续四次输入错误密码,返回*/
{ cprintf("Too many errors!");
goto inEND;
}
cprintf("\nInput the your keywords:");/*输入学生密码*/
scanf("%s",key);
do{
cprintf("\nInput the class number:");
scanf("%u",&no);
in2:cprintf("\n Input the student number:");
scanf("%ld",&stu_num);
if(((stu_num/100)%100)!=no)
{ cprintf("Wrong numbers!");
goto in2;
}
cprintf("\n Input the subject number:");
scanf("%u",&sbj_num);
for(p1=headp->next;p1!=NULL;p1=p1->next)
{
if(p1->no==no) break; /*找到班级入口*/
else continue;
}
if(p1==NULL){WarnCLA();goto inEND;} /*班级不存在*/
for(p2=p1->first;p2!=NULL;p2=p2->next)
{
if(p2->number!=stu_num)continue;
else break;
} /*找到学生*/
if(p2==NULL){WarnSTU();goto inEND;}
if(strcmp(p2->STUkey,key)) /*验证密码*/
{ cprintf( "Wrong keywords! ");
n++;
goto in1;
}
for(p3=p2->first;p3!=NULL;p3=p3->next)
{
if(p3->number!=sbj_num)continue;
else break;
} /*找到课程入口*/
if(p3==NULL){WarnSUB();goto inEND;} /*课程尚未创建*/
/*输入你要修改的项目*/
cprintf("\n\t student name:%-16s \t subject name:%-13s \t credit:%-10d",p2->name,p3->name,p3->credit);
inx: cprintf("\nInput the item you want to modify ( 1:name ,2:credit ,3:number ):");
scanf("%d",&order);
if(order==1)
{ flag=0;
for(i=0;i<strlen(p3->name);i++)
p3->name[i]=' ';
cprintf("\t Input the new name :");
scanf("%s",p3->name);
}
if(order==2)
{ flag=0;
cprintf("\t Input the new cridit:");
p3->credit=0;
scanf("%u",&p3->credit);
}
if(order==3)
{ flag=0;
cprintf("\t Input the new number:");
p3->number=0;
scanf("%u",&p3->number);
}
if(flag){
cprintf("\t Input item error! ");
goto inx;
}
cprintf("SUCESSES!Continue?(y/n)");
while(isspace(ch=getchar()));
}while(ch=='y'||ch=='Y');
inEND: return(headp);
}
struct CLASS * mod_score(struct CLASS *headp)/*修改科目的成绩*/
{
struct CLASS *p1;
struct STUD *p2;
struct SUB *p3;
int order;
char key[12];
int no,subnum=0;
long stu_num;
int n=0,flag=1,sum=0,credit=0;
in1:if(n>3) /*连续四次输入错误密码*/
{ cprintf("Too many errors!");
goto inEND;
}
cprintf("\nInput the your keywords:");
scanf("%s",key);
cprintf("\n Input the class number:");
scanf("%u",&no);
in2:cprintf("\n Input the student number:");
scanf("%ld",&stu_num);
if(((stu_num/100)%100)!=no)
{ cprintf("Wrong numbers!");
goto in2;
}
cprintf("\n Input the subject number:");
scanf("%d",&subnum);
for(p1=headp->next; p1!=NULL; p1=p1->next)
{
if(p1->no==no) break;/*找到班级入口*/
else continue;
}
if(p1==NULL){WarnCLA();goto inEND;}
for(p2=p1->first; p2!=NULL; p2=p2->next)
{
if(p2->number!=stu_num)continue;
else break;
} /*找到学生*/
if(p2==NULL){WarnSTU();goto inEND;}
if(strcmp(p2->STUkey,key))
{ cprintf( "Wrong keywords! ");
n++;
goto in1;
}
p2->average=0;
for(p3=p2->first;p3!=NULL;p3=p3->next)
{
if(p3->number==subnum)break;
else continue;
}
if(p3==NULL){WarnSUB();goto inEND;}
cprintf("\n ps_score:%-17u \t tx_score:%-16u \t un_score:%-14u", p3->ps_score,p3->tx_score,p3->un_score );
iny: cprintf("\t input the item you want to modify ( 1:ps_score ,2:tx_score ,3:un_score ): ");
scanf("%d",&order);
struct CLASS * mod_sbj(struct CLASS *headp)/*修改科目信息*/
{
struct CLASS *p1;
struct STUD *p2;
struct SUB *p3;
int order;
char key[12];
int ch, n=0;
int sbj_num,no,flag=1;
long stu_num;
in1:if(n>3) /*连续四次输入错误密码,返回*/
{ cprintf("Too many errors!");
goto inEND;
}
cprintf("\nInput the your keywords:");/*输入学生密码*/
scanf("%s",key);
do{
cprintf("\nInput the class number:");
scanf("%u",&no);
in2:cprintf("\n Input the student number:");
scanf("%ld",&stu_num);
if(((stu_num/100)%100)!=no)
{ cprintf("Wrong numbers!");
goto in2;
}
cprintf("\n Input the subject number:");
scanf("%u",&sbj_num);
for(p1=headp->next;p1!=NULL;p1=p1->next)
{
if(p1->no==no) break; /*找到班级入口*/
else continue;
}
if(p1==NULL){WarnCLA();goto inEND;} /*班级不存在*/
for(p2=p1->first;p2!=NULL;p2=p2->next)
{
if(p2->number!=stu_num)continue;
else break;
} /*找到学生*/
if(p2==NULL){WarnSTU();goto inEND;}
if(strcmp(p2->STUkey,key)) /*验证密码*/
{ cprintf( "Wrong keywords! ");
n++;
goto in1;
}
for(p3=p2->first;p3!=NULL;p3=p3->next)
{
if(p3->number!=sbj_num)continue;
else break;
} /*找到课程入口*/
if(p3==NULL){WarnSUB();goto inEND;} /*课程尚未创建*/
/*输入你要修改的项目*/
cprintf("\n\t student name:%-16s \t subject name:%-13s \t credit:%-10d",p2->name,p3->name,p3->credit);
inx: cprintf("\nInput the item you want to modify ( 1:name ,2:credit ,3:number ):");
scanf("%d",&order);
if(order==1)
{ flag=0;
for(i=0;i<strlen(p3->name);i++)
p3->name[i]=' ';
cprintf("\t Input the new name :");
scanf("%s",p3->name);
}
if(order==2)
{ flag=0;
cprintf("\t Input the new cridit:");
p3->credit=0;
scanf("%u",&p3->credit);
}
if(order==3)
{ flag=0;
cprintf("\t Input the new number:");
p3->number=0;
scanf("%u",&p3->number);
}
if(flag){
cprintf("\t Input item error! ");
goto inx;
}
cprintf("SUCESSES!Continue?(y/n)");
while(isspace(ch=getchar()));
}while(ch=='y'||ch=='Y');
inEND: return(headp);
}
struct CLASS * mod_score(struct CLASS *headp)/*修改科目的成绩*/
{
struct CLASS *p1;
struct STUD *p2;
struct SUB *p3;
int order;
char key[12];
int no,subnum=0;
long stu_num;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -