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

📄 classmanage.c

📁 在权衡各编程语言及各数据库系统之后
💻 C
📖 第 1 页 / 共 2 页
字号:
  do{if(!p) printf("No informatiom!\n");
  else{printf("Please input the course name that will find:\n");
  scanf("%s",ch);
  m=find_char_scc(p,ch);
   if(m) show_sco_time_classroom(&m->info);
       }
 printf("\n");
 printf("Do you want to continue to search ?(y/n)\n");
 do{
    fflush(stdin);  /*清空缓存区*/
    scanf("%c",&a);
    }while((a!='N'&&a!='n')&&(a!='Y'&&a!='y'));
}while(a=='y'||a=='Y');
}

void look_scc(nodescc *head)   /*4查找学校某门课程的学生名单*/
{nodescc *p,*m;
 char ch[20];
 int i;
 p=head->next;
 if(!p)   {printf("NO intformatiom!\n");
            }
  else{ printf("Please input the course name that you will look : \n\n");
      scanf("%s",ch);
	  m=find_char_scc(p,ch);
if(m)
      show_scc_student(&m->info);
       }
}

void output_scc_grade(nodescc *head)   /*5输出学校某门课程的学生成绩*/
{nodescc *p,*m;
 char ch[20],a;
  p=head->next;
 do{ if(!p) printf("No informatiom!\n");
  else{printf("Please input the course name that you will look : \n");
  scanf("%s",ch);
  m=find_char_scc(p,ch);
if(m)
 show_scc_grade(&m->info);}
printf("Do you want to continue to search ?(y/n)");
  do{fflush(stdin);
    scanf("%c",&a);
   }while((a!='N'&&a!='n')&&(a!='Y'&&a!='y'));
}while(a=='Y'||a=='y');
}

nodescc *dele_scc(nodescc *head)        /*6删除学校的某门课程*/
{char ch[20];
 nodescc *m,*k;

 k=head->next;
  if(!k) printf("No informatiom!\n\n");
  else{
   printf("Please input the deleting course name :\n");
   scanf("%s",ch);
   m=find_char_scc(k,ch);
  if(m)
   {while(k->next==m)
   {
    k=k->next;
    }
   k->next=m->next;
   free(m);
   printf("Delete success !\n");
   printf("Press any key to continue....");
   getch();
 system("cls");}
}
return head;

}

nodescc *add_scc(nodescc *head)         /*7增加学校的课程*/
{char ch[20];
 nodescc *p,*m,k;
 p=head->next;
 while(p->next)
   {p=p->next;}
    m=(nodescc *)malloc(sizeof(nodescc));
    k.info=set_scc_course(&k.info);
     m->info=k.info;
     p->next=m;
    m->next=null;
 printf("Add success!\n");
 return head;  }



/*************************************学生课程表*************************************/

nodesco *luru_sco(nodesco *head)                 /*1录入学生的课程表*/
{char ch;
   Sco s;
   nodesco *q,*k;
   int i=1;
   k=head;
   do{
     q=(nodesco *)malloc(sizeof(nodesco));
     printf("\n\n\n");
     printf("Please input student %d course information:\n\n",i);
     s=set_sco_course(&s);
     q->info=s;
     k->next=q;
     k=k->next;
     q->next=null;
      system("cls");
     printf("\n\n\n");
     printf("Do you want to continue to input under a student course information?(y/n)\n\n");
     do{
       fflush(stdin);
       scanf("%c",&ch); 
      }while((ch!='N'&&ch!='n')&&(ch!='Y'&&ch!='y'));
     i++;
  }while(ch=='Y'||ch=='y');
system("cls");

return head;}


nodesco *add_sco(nodesco *head)          /*2在学生课程表内增加一门课程*/
{ char ch[20];
 nodesco *m;
  m=head->next;
if(!m) printf("No informatiom!\n");
  else{
    printf("Please input the student name of adding course:\n");
   scanf("%s",ch);
   m=find_char_sco(m,ch);
if(m)
   add_sco_course(&m->info);
   printf("Add success!\n");
 }

return head;
}


nodesco *dele_sco(nodesco *head)               /*3在学生课程表内的删除一门课程*/
{char ch[20];
 nodesco *m;
 m=head->next;
 if(m) printf("NO information!\n");
 else{
 printf("Please input the student name of deleting course:\n");
  scanf("%s",ch);
  m=find_char_sco(m,ch);
if(m)
{delete_sco_course(&m->info);
printf("Delete success !\n\n");}
printf("Press any key to continue....");
getch();
system("cls");
return head;}
}



void cha_sco(nodesco *head)                   /*4查询学生的课程表*/
{char ch[20];
 char a;
 nodesco *m;
 int i;
do{ 
   m=head->next;
   if(!m) printf("No informatiom!\n");
   else{
           printf("Please input the student name of Searching  :\n");
           scanf("%s",ch);
           m=find_char_sco(m,ch);
             if(m) for(i=0;i<m->info.conum;i++)
                    {printf("The %s student course is:\n",ch);
                     printf("---Course %d is:\n",i+1);
                     printf("---Course name: %s\n",m->info.cou2[i].cname);
                     printf("---Course NO. is: %s\n",m->info.cou2[i].cnum);     
                     printf("---Course classroom is: %s\n",m->info.cou2[i].cclassroom);
                    }                      
        }
    printf("\n");
    printf("Do you want to continue to search?(y/n)\n\n");    
 do{ fflush(stdin);
    scanf("%c",&a); 
    printf("\n");}while((a!='N'&&a!='n')&&(a!='Y'&&a!='y'));
  }while(a=='Y'||a=='y');
}



void look_sco(nodesco *head)                    /*5浏览学生的课程表*/
{nodesco *m;
  int i,j; 
  m=head->next;
  if(!m) { printf("No informatiom!\n");}
  else{  while(m) 
         {   printf("The %s student course list is : \n",m->info.stu2.sname);
        for(i=0;i<m->info.conum;i++)    
           {printf("---Course %d is:\n",i+1);
            printf("---------Course name: %s\n",m->info.cou2[i].cname);   
            printf("---------Course NO. is: %s\n",m->info.cou2[i].cnum);
	    printf("---------Course classroom is: %s\n",m->info.cou2[i].cclassroom);            
            }
            m=m->next;
            printf("Press an key to continue...\n");
            getch();
            system("cls");
       }
       
       }

}



/************************************查找匹配的字符***********/
nodescc *find_char_scc(nodescc *head,char a[20])     /*学校的课程*/
{ nodescc *p;
  int i=0;
  p=head;
  if(!p) {printf("No information!\n");
               printf("Press any key to continue....\n");
               getch();
               return 0;
                }
  else {   i=strcmp(a,p->info.cou1.cname);
         while(p&&(i!=0))
          {p=p->next;
          i=strcmp(a,p->info.cou1.cname);
          
          }
      if(!p){system("cls"); 
            printf("Cannot find!\n");
               printf("Press any key to continue....\n");
               getch();
               return 0;
              }
      return p;
     }

}



nodesco *find_char_sco(nodesco *head,char a[20])   /*学生的课程表*/
{ nodesco *p;
int i=0;
 p=head;
 if(!p) {printf("No information!\n");
               printf("Press any key to continue....\n");
               getch();
               return 0;
                }
 else{     i=strcmp(a,p->info.stu2.sname);
      while(p&&(i!=0))
       {p=p->next;
        i=strcmp(a,p->info.stu2.sname);
             }
       if(!p){printf("Cannot find!\n"); 
            
              printf("Press any key to continue....\n");
               getch();
                 system("cls");
               return 0;
              
              }
         return p;
     }
}
/***********************系统主菜单************************/
int showmeun()
{
    int  a;                                                            /*学校课程管理系统*/
    printf("\n\n\n\n");
    printf("  **------------------------------------------------------**\n");
    printf("  |         School Curriculum Management System            |\n");
    printf("  |--------------------------------------------------------|\n");
    printf("  |          1.  School Curriculum Management              |\n");   /*学校管理*/
    printf("  |                                                        |\n");    
    printf("  |          2.  Student Curriculum Management             |\n");   /*学生管理*/
    printf("  |                                                        |\n");
    printf("  |          3.  exit System                               |\n");
    printf("  |                                                        |\n");    /*退出 */  
    printf("  **------------------------------------------------------**\n");
    printf("Please input (1~3):\n");
   while(scanf("%d",&a)!=1)
     { if(a==2) return a;
       if(a==3)  return a;
      else break;
    }


return a;
}






/*****************************************学校课程管理子系统******************************************************/
nodescc *sccsub(nodescc *head)
{char ch;
  int in;
 system("cls");
 
do{
 printf("\n\n\n");
    printf("**--------------------------------------------**\n");
    printf("|            School Curriculum Management       |\n");
    printf("|----------------------------------------- -----|\n");
    printf("|    1. Set school course                       |\n");
    printf("|                                               |\n");
    printf("|    2.change course time and plass             |\n");
    printf("|                                               |\n");
    printf("|    3.Search  course time and plase            |\n");
    printf("|                                               |\n");
    printf("|    4.Output student name list of school course|\n");
    printf("|                                               |\n");
    printf("|    5.Output one course student grade          |\n");
    printf("|                                               |\n");
    printf("|    6.Delete one course                        |\n");
    printf("|                                               |\n");
    printf("|    7.Add one course                           |\n");
    printf("|                                               |\n");
    printf("|    8.exir system                              |\n");
    printf("**--------------------------------------------**\n");
    printf(" please choice:");
    scanf("%d",&in);
   system("cls");

switch(in)
        {
            case 1 : head=luru_scc(head);   /*1录入学校课程*/
                     break;
            case 2 : head=change_scc(head);     /*2修改学校课程的上课时间地点*/
                     break;
            case 3 : print_scc(head);    /*3查询学校上课时间*/
                     break;
            case 4 : look_scc(head);      /*4查询学校某门课程的学生名单*/
                     break;
            case 5 : output_scc_grade(head);      /*5输出学校某门课程的学生成绩*/
                     break;
            case 6:  head=dele_scc(head);      /*6删除学校的某门课程*/
                     break;
            case 7 :head=add_scc(head);     /*7增加学校的课程*/
                     break;
            case 8: break;
             
            default: printf("NOt this choice! Please choice again(1-8)");
                     getch();
                     system("cls");
                     break;
        }
      printf("Press any key to continue...\n");
      getch();                                 /*等待输入任一键,从屏幕读一个字符不显示在屏幕上*/
        system("cls");
       }while(in!=8);
    system("cls");
return head;}



/*********************************学生课程表管理子菜单*****************************************/
nodesco *scosub(nodesco *head)
{
    int  in;
    char ch;
    
    do
    {
        system("cls");
        printf("\n\n\n\n");
        printf("    **--------------------------------------**\n");
        printf("    |      Student Curriculum Management     |\n");
        printf("    |----------------------------------------|\n");
        printf("    |        1.  Set student Curriculum      |\n");
        printf("    |                                        |\n");
        printf("    |        2.  Add one course of student   |\n");
        printf("    |                                        |\n");
        printf("    |        3.Delete one couse of student   |\n");
        printf("    |                                        |\n");
        printf("    |        4.  Search courses of student   |\n");
        printf("    |                                        |\n");
        printf("    |        5.  View student courses        |\n");
        printf("    |                                        |\n");
        printf("    |        6.  Exit system                 |\n");
        printf("    **--------------------------------------**\n");
        printf("     Please Choice : ");
        scanf("%d",&in);
        system("cls");
       switch(in)
        {
            case 1 : head=luru_sco(head);             /*1录入学生的课程表*/
                     break;
            case 2 : head=add_sco(head);            /*2在学生课程表内增加一门课程*/
                     break;
            case 3 : head=dele_sco(head);          /*3在学生课程的删除一门课程*/
                     break;
            case 4 : cha_sco(head);               /*4查询学生的课程表*/
                     break;
            case 5 : look_sco(head);             /*5浏览学生的课程表*/
                     break;
            case 6 : return head;               /*退出系统*/
          
            default: printf("NOt this choice! Please choice again");
                     break;
        }
       printf("Press any key to continue....\n");
       getch();
       system("cls");
    }while(1);
}

⌨️ 快捷键说明

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