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

📄 stumanager.c

📁 学生管理系统
💻 C
📖 第 1 页 / 共 5 页
字号:

               }
                else if(j==1)
               {
                   setfillstyle(1,15);
                   bar(stx3+20,sty+(n%16)*15-2,stx3+30, sty+(n%16+1)*15-6 );
                   setcolor(9);
                   outtextxy(stx4+22,sty+(n%16)*15,ud);


                   j=2;
               }
               else if(j==2)
               {
                   setfillstyle(1,15);
                   bar(stx4+20,sty+(n%16)*15-2,stx4+30,sty+(n%16+1)*15-6);
                   setcolor(9);
                   outtextxy(stx5+19,sty+(n%16)*15,ud);


                   j=3;
               }
              else if(j==3)
               {
                   setfillstyle(1,15);
                   bar(stx5+17,sty+(n%16)*15-2,stx5+27,sty+(n%16+1)*15-6);
                   setcolor(9);
                   outtextxy(stx6+19,sty+(n%16)*15,ud);


                    j=4;
               }
               else if(j==4)
               {
                     setfillstyle(1,15);
                     bar(stx6+17,sty+(n%16)*15-2,stx6+27,sty+(n%16+1)*15-6) ;
                     setcolor(9);
                     outtextxy(stx7+16,sty+(n%16)*15,ud);


                     j=5;
               }
               else if(j==5)
               {
                   j=0;
                   setfillstyle(1,15);
                   bar(stx7+14,sty+(n%16)*15-2,stx7+24,sty+(n%16+1)*15-6);
                   setcolor(9);
                   outtextxy(stx2+25,sty+(n%16)*15,right);
               }
           }
           break;
           case Up:
           {
               if(j==1&&(p1->math<100))
               {
                   p1->math++;
                   sprintf(score[0],"%d",p1->math);
                   setfillstyle(1,15);
                   bar(stx3-5,sty+(n%16)*15-2,stx3+21,sty+(n%16+1)*15-6);
                   setcolor(3);
                   outtextxy(stx3-5,sty+(n%16)*15,score[0]);
               }
               else if(j==2&&(p1->english<100))
               {
                   p1->english++;
                   sprintf(score[1],"%d",p1->english);
                   setfillstyle(1,15);
                   bar(stx4-7,sty+(n%16)*15-2,stx4+20,sty+(n%16+1)*15-6);
                   setcolor(3);
                   outtextxy(stx4-5,sty+(n%16)*15,score[1]);
               }
               else if(j==3&&(p1->clanguage<100))
               {
                   p1->clanguage++;
                   sprintf(score[2],"%d",p1->clanguage);
                   setfillstyle(1,15);
                   bar(stx5-15,sty+(n%16)*15-2,stx5+17,sty+(n%16+1)*15-6) ;
                   setcolor(3);
                   outtextxy(stx5-10,sty+(n%16)*15,score[2]);
               }
               else if(j==4&&(p1->cpp<100))
               {
                   p1->cpp++;
                   sprintf(score[3],"%d",p1->cpp);
                   setfillstyle(1,15);
                   bar(stx6-15,sty+(n%16)*15-2,stx6+17,sty+(n%16+1)*15-6);
                   setcolor(3);
                   outtextxy(stx6-10,sty+(n%16)*15,score[3]);

               }
               else if(j==5&&(p1->java<100))
               {
                   p1->java++;
                   sprintf(score[4],"%d",p1->java);
                   setfillstyle(1,15);
                   bar(stx7-15,sty+(n%16)*15-2,stx7+13,sty+(n%16+1)*15-6);
                   setcolor(3);
                   outtextxy(stx7-10,sty+(n%16)*15,score[4]);
               }

           }
           break;
           case Down:
           {
               if(j==1&&(p1->math>0))
               {
                   p1->math--;
                   sprintf(score[0],"%d",p1->math);
                   setfillstyle(1,15);
                   bar(stx3-5,sty+(n%16)*15-2,stx3+21,sty+(n%16+1)*15-6);
                   setcolor(3);
                   outtextxy(stx3-5,sty+(n%16)*15,score[0]);
               }
               else if(j==2&&(p1->english>0))
               {
                   p1->english--;
                   sprintf(score[1],"%d",p1->english);
                   setfillstyle(1,15);
                   bar(stx4-5,sty+(n%16)*15-2,stx4+20,sty+(n%16+1)*15-6);
                   setcolor(3);
                   outtextxy(stx4-5,sty+(n%16)*15,score[1]);
               }
               else if(j==3&&(p1->clanguage>0))
               {
                   p1->clanguage--;
                   sprintf(score[2],"%d",p1->clanguage);
                   setfillstyle(1,15);
                   bar(stx5-15,sty+(n%16)*15-2,stx5+17,sty+(n%16+1)*15-6) ;
                   setcolor(3);
                   outtextxy(stx5-10,sty+(n%16)*15,score[2]);
               }
               else if(j==4&&(p1->cpp>0))
               {
                   p1->cpp--;
                   sprintf(score[3],"%d",p1->cpp);
                   setfillstyle(1,15);
                   bar(stx6-15,sty+(n%16)*15-2,stx6+17,sty+(n%16+1)*15-6);
                   setcolor(3);
                   outtextxy(stx6-10,sty+(n%16)*15,score[3]);

               }
               else if(j==5&&(p1->java>0))
               {
                   p1->java--;
                   sprintf(score[4],"%d",p1->java);
                   setfillstyle(1,15);
                   bar(stx7-15,sty+(n%16)*15-2,stx7+13,sty+(n%16+1)*15-6);
                   setcolor(3);
                   outtextxy(stx7-10,sty+(n%16)*15,score[4]);
               }

           }
           break;
           case Right:
           {
               if(j==0&&accept==3)
               {
                   if(pop==1)
                   {

                       pop=2;
                   }
                   else
                   {
                       pop=1;
                   }

                   if(strcmp(p1->pope,"sup")!=0)
                   {
                       if(pop==1)
                           strcpy(p1->pope,"stu");
                       else if(pop==2)
                           strcpy(p1->pope,"mon");
                   }

                   setfillstyle(1,15);
                   bar(stx2-15,sty+(n%16)*15-2,stx3-33,sty+(n%16+1)*15-6);
                   setcolor(3);
                   outtextxy(stx2-10,sty+(n%16)*15,p1->pope);

               }
           }
           break;

           case Enter:
           {
               p1->math=atof(score[0]);
               p1->english=atof(score[1]);
               p1->clanguage=atof(score[2]);
               p1->cpp=atof(score[3]);
               p1->java=atof(score[4]);
               fp=fopen("Info.txt","w");
               fprintf(fp,"%-15s%5d\n","Class1",n1);
               p1=head1->next;
               free(head1);
               while(p1)
               {
                   fprintf(fp,"%-10s%10s%5d%5d%5d%5d%5d\r\n",p1->name,p1->pope,p1->math,p1->english,p1->clanguage,p1->cpp,p1->java);
                   q=p1;
                   p1=p1->next;
                   free(q);
               }
               fprintf(fp,"\n%-15s%5d\n","Class2",n2);
               p2=head2->next;
               free(head2);
               while(p2)
               {
                   fprintf(fp,"%-10s%10s%5d%5d%5d%5d%5d\r\n",p2->name,p2->pope,p2->math,p2->english,p2->clanguage,p2->cpp,p2->java);
                   q=p2;
                   p2=p2->next;
                   free(q);
               }
               fprintf(fp,"\n%-15s%5d\n","Class3",n3);
               p3=head3->next;
               free(head3);
               while(p3)
               {
                   fprintf(fp,"%-10s%10s%5d%5d%5d%5d%5d\r\n",p3->name,p3->pope,p3->math,p3->english,p3->clanguage,p3->cpp,p3->java);
                   q=p3;
                   p3=p3->next;
                   free(q);
               }
               fclose(fp);
               Update2();
               return;
           }

    
           default:break;
           case Esc:return;
       }
   }
}


void Update1(int cla)
{
    FILE*fp;
    int i=0;
    int n=0;
    int j=0;
    struct Information*p1,*p2,*p3,*head1,*head2,*head3,*q;
    int n1,n2,n3;
    char pope[4]="";
    char name[11]="";
    char password[11]="";

    fp=fopen("stu.txt","r");
    for(i=0;i<cla-1;i++)
    {
        fscanf(fp,"%s%d",name,&n);
        for(j=0;j<n;j++)
        {
            fscanf(fp,"%s%s%s",name,name,name);
        }
    }
    fscanf(fp,"%s%d",name,&n);
    for(i=0;i<n;i++)
    {
        fscanf(fp,"%s%s%s",name,password,pope);     /*最后一条读出所要更新的数据*/
    }
    fclose(fp);
    fp=fopen("Info.txt","r");

    fscanf(fp,"%s%d",password,&n1);

    p1=head1=(struct Information*)malloc(sizeof(struct Information));
    p1->next=NULL;
    for(i=0;i<n1;i++)
    {
        p1=p1->next=(struct Information*)malloc(sizeof(struct Information));
        p1->next=NULL;
        fscanf(fp,"%s%s%d%d%d%d%d",p1->name,p1->pope,&(p1->math),&(p1->english),&(p1->clanguage),&(p1->cpp),&(p1->java));

    }
    fscanf(fp,"%s%d",password,&n2);

    p2=head2=(struct Information*)malloc(sizeof(struct Information));
    p2->next=NULL;
    for(i=0;i<n2;i++)
    {
        p2=p2->next=(struct Information*)malloc(sizeof(struct Information));
        p2->next=NULL;
        fscanf(fp,"%s%s%d%d%d%d%d",p2->name,p2->pope,&(p2->math),&(p2->english),&(p2->clanguage),&(p2->cpp),&(p2->java));

    }
    fscanf(fp,"%s%d",password,&n3);

    p3=head3=(struct Information*)malloc(sizeof(struct Information));
    p3->next=NULL;
    for(i=0;i<n3;i++)
    {
        p3=p3->next=(struct Information*)malloc(sizeof(struct Information));
        p3->next=NULL;
        fscanf(fp,"%s%s%d%d%d%d%d",p3->name,p3->pope,&(p3->math),&(p3->english),&(p3->clanguage),&(p3->cpp),&(p3->java));

    }
    fclose(fp);
    if(cla==1)
    {
        q=p1->next=(struct Information*)malloc(sizeof(struct Information));
        n1++;

    }
    else if(cla==2)
    {
        q=p2->next=(struct Information*)malloc(sizeof(struct Information));
        n2++;
    }
    else if(cla==3)
    {
        q=p3->next=(struct Information*)malloc(sizeof(struct Information));
        n3++;
    }
    q->next=NULL;
    strcpy(q->name,name);
    strcpy(q->pope,pope);
    q->math=q->english=q->clanguage=q->cpp=q->java=-1;    /*会员分数初始值均为-1*/

    fp=fopen("Info.txt","w");
    fprintf(fp,"%-15s%5d\n","Class1",n1);
    p1=head1->next;
    free(head1);
    while(p1)
    {
        fprintf(fp,"%-10s%10s%5d%5d%5d%5d%5d\r\n",p1->name,p1->pope,p1->math,p1->english,p1->clanguage,p1->cpp,p1->java);
        q=p1;
        p1=p1->next;
        free(q);
    }
    fprintf(fp,"\n%-15s%5d\n","Class2",n2);
    p2=head2->next;
    free(head2);
    while(p2)
    {
        fprintf(fp,"%-10s%10s%5d%5d%5d%5d%5d\r\n",p2->name,p2->pope,p2->math,p2->english,p2->clanguage,p2->cpp,p2->java);
        q=p2;
        p2=p2->next;
        free(q);
    }
    fprintf(fp,"\n%-15s%5d\n","Class3",n3);
    p3=head3->next;
    free(head3);
    while(p3)
    {
        fprintf(fp,"%-10s%10s%5d%5d%5d%5d%5d\r\n",p3->name,p3->pope,p3->math,p3->english,p3->clanguage,p3->cpp,p3->java);
        q=p3;
        p3=p3->next;
        free(q);
    }
    fclose (fp);
    return;
}

void File()
{
    int i=0;
    int key=0;

    DrawFile(0);
    while(1)
    {
        key=bioskey(0);
        switch(key)
        {
            case Down:
            {
                if(i==0)
                {
                    i++;

                }

                DrawFile(i);
            }
            break;
            case Up:
            {
                if(i==1)
                {
                    i--;
                }
                DrawFile(i);
            }

            break;
            case Enter:
            {
                if(i==1) {closegr(); exit(0);  }
                else Help();
            }
            break;
            case Esc:
            {
                setfillstyle(1,7);
                bar(20,37,100,67);
                return;
            }

            default:break;
        }
    }


}
void DrawFile(int m)                              /*画下拉菜单2 Member*/

{
    char Class[][5]={"Help","Exit"};
    int i=0;

    setfillstyle(1,8);
    bar(20,37,100,67);
    setcolor(WHITE);

    for(i=0;i<2;i++)
      {
          outtextxy(25,43+i*15,Class[i]);
      }

    setfillstyle(1,11);
    bar(20,37+15*m,100,37+15*(m+1));
    setcolor(RED);
    outtextxy(25,43+m*15,Class[m]);
    return;
}

void Help()
{
    int i=0;

    setfillstyle(1,6);
    bar(175,190,390,315);
    for(i=0;i<7;i++)
    {
        drawmat(sentense1+i*32,16,150+(i+2)*15,200,GREEN);
    }

    for(i=0;i<4;i++)
    {
        drawmat(sentense2+i*32,16,150+(i+11)*15,200,GREEN);
    }

    drawmat(zuo16H,16,150+5*15,230,GREEN);
    drawmat(zhe16H,16,150+6*15,230,GREEN);
    setcolor(GREEN);
    outtextxy(150+7*15,233,": ");
    drawmat(zhu16H,16,150+9*15,230,RED);
    drawmat(feng16H,16,150+11*15,230,RED);
    setcolor(3);
    outtextxy(190,270,"Press any key to exit.");
    getch();
    setfillstyle(1,7);
     bar(175,190,390,315);
    return;
}

void drawmat(char *mat,int matsize,int x,int y,int color)
/*依次:字模指针、点阵大小、起始坐标(x,y)、颜色*/
{
  int i, j, k, n;
  n = (matsize - 1) / 8 + 1;
  for(j = 0; j < matsize; j++)
    for(i = 0; i < n; i++)
      for(k = 0;k < 8; k++)
        if(mat[j * n + i] & (0x80 >> k))  /*测试为1的位则显示*/
          putpixel(x + i * 8 + k, y + j, color);
  return;
}


void Update2()
{
    FILE*fp;
    int i=0,n=0;
    struct Info*p1,*p2,*p3,*q,*head1,*head2,*head3;
    char name[11]="";

    char pope[4]="";
    int n1=0,n2=0,n3=0;
    int temp=0;


    fp=fopen("stu.txt","r");

    

⌨️ 快捷键说明

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