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

📄 学生成绩管理系统.txt

📁 这是学生成绩查询系统.用C语言编写的,是学习C语言的课程设计
💻 TXT
字号:
 #include<stdlib.h>

#include<graphics.h>

struct Snow

{

 int x;

 int y;

 int speed;

}snow[100];

int snownum=0;

int size;

int change=10;

void *save1,*save2;

void Copy();

void DrawSnow();

void Pr();

void main(void)

{int gd=DETECT,gm;

 initgraph(&gd,&gm,"c:\\turboc2");

 Copy();

 DrawSnow();

 getch();

 closegraph();

}

void Copy()

{

 setcolor(0);

 setfillstyle(SOLID_FILL,15);

  fillellipse(200,200,4,4);

 size=imagesize(196,196,204,204);

 save1=malloc(size);

 save2=malloc(size);

 getimage(196,196,204,204,save1);

 getimage(96,96,104,104,save2);

}

void Pr()

{

 int s[15]={0,100,150,200,150,200,250,150,250,300,250,150,100,250,350};

 setcolor(change/10);

 settextstyle(0,0,4);

 outtextxy(150,200,"Welcome!!!");

 sound(s[change/10]);

}void DrawSnow()

{int i;

 int sx[62];

 randomize();

 for(i=0;i<62;i++)

  sx[i]=(i+2)*10;

 cleardevice();

 while(!kbhit())

 {

  Pr();

  if(snownum!=100)

  {

   snow[snownum].speed=2+random(5);

   i=random(62);

   snow[snownum].x=sx[i];

   snow[snownum].y=10-random(100);

  }

  for(i=0;i<snownum;i++) 

putimage(snow[i].x,snow[i].y,save2,COPY_PUT);

   Pr();

  if(snownum!=100)

   snownum++;

  /*delay(300);*/

  setfillstyle(SOLID_FILL,15);

  for(i=0;i<snownum;i++)

   {

    snow[i].y+=snow[i].speed;

    putimage(snow[i].x,snow[i].y,save1,COPY_PUT);

    if(snow[i].y>500)

    snow[i].y=10-random(200);

   }

  change++;

  if(change==140)

  change=10;

  }

  nosound();

}

2学生成绩管理系统(自己设计界面)

 #define N 1

struct student

{char num[10];

 char name[10];

 int score[4];

 float ave;

 }stu[N];

main()

{int i,j,max,maxi,sum;

 float average;

 for(i=0;i<N;i++)

 {printf("Please input scores of student %d :\n",i+1);

  printf("NO.:");

  scanf("%s",stu[i].num);

  printf("name:");

  scanf("%s",stu[i].name);

  for(j=0;j<3;j++)

  {printf("score %d :",j+1);

   scanf("%d",&stu[i].score[j]);

  }

 }

 average=0;

 max=0;

 maxi=0;

 for(i=0;i<N;i++)

 {sum=0;

  for(j=0;j<3;j++)

   sum+=stu[i].score[j];

  stu[i].ave=sum/3.0;

  average+=stu[i].ave;

 if(sum>max)

  {max=sum;

   maxi=i;

  }

 }

 average/=N;

 printf("   NO.     name   score1   score2   score3   average\n");

 for(i=0;i<N;i++)

 {printf("%5s",stu[i].num);

  printf("%10s",stu[i].name);

  for(j=0;j<3;j++)

   printf("%9d",stu[i].score[j]);

  printf("%8.2f\n",stu[i].ave);

 }

 printf("average=%6.2f\n",average);

 printf("The highest score is : %s,score total :%d\n",stu[maxi].name,max);

 getch();

}

 

 

3.异或加密与解密

#include<stdio.h>

#include<stdlib.h>

#include<conio.h>

#include<string.h>

 

void jiami(char *in,char *pwd,char *out);

void main(int argc,char *argv[])

{

 char in[30];

 char out[30];

 char pwd[8];

 if(argc!=4)

 {

  printf("\Input file name:\n");

  gets(in);

  printf("Please enter password:\n");

  gets(pwd);

  printf("Output file name:\n");

  gets(out);

  jiami(in,pwd,out);

 }

 else

 {

  strcpy(in,argv[1]);

  strcpy(pwd,argv[2]);

  strcpy(out,argv[3]);

  jiami(in,pwd,out);

 }

}

void jiami(char *in,char *pwd,char *out_file)

{

 FILE *fp1,*fp2;

 register char ch;

 int j=0;

 int k=0;

 fp1=fopen(in,"rb");

 if(fp1==NULL)

 {

  printf("Cannot open in-file!\n"); 
 exit(1);

 }

 fp2=fopen(out_file,"wb");

 if(fp2==NULL)

 {

  printf("Cannot open or create output-file!\n");

  exit(1);

 }

 while(pwd[++k]);

 ch=fgetc(fp1);

 while(!feof(fp1))

 {

  fputc(ch^pwd[j>=k?j=0:j++],fp2);

  ch=fgetc(fp1);

 }

 fclose(fp1);

 fclose(fp2);

}

4.移位加密与解密

#include"stdio.h"

main()

{

  int choice=0,k;

  FILE *fp1,*fp2;

   char c,filename1[30],filename2[30];

   printf("Please input two deferent filename:");

   scanf("%s%s",filename1,filename2);

   printf("Please input the password :\n");

   scanf("%d",&k);

   if((fp1=fopen(filename1,"r"))==NULL)

     printf("\nERROR!CAN NOT OPEN THE FILE\n");

       else{

      fp2=fopen(filename2,"w");

    printf("\nChoose:(1-jiami 2-jiemi)");

    scanf("%d", &choice);

    switch(choice){

     case 1:

          do{

               c=getc(fp1);

              if(((c>='a')&&(c<='z'-k))||((c>='A')&&(c<='Z'-k)))

                      putc(c+k,fp2);

                else if(((c>'z'-k)&&(c<='z'))||((c>'Z'-k)&&(c<='Z')))

                      putc(c-(26-k),fp2);

                  else

                         putc(c,fp2);

             }while(c!=EOF);

          break;

         case 2:

           do{

               c=getc(fp1);

              if(((c>='a'+k)&&(c<='z'))||((c>='A'+k)&&(c<='Z')))

                      putc(c-k,fp2);

                else if(((c>='a')&&(c<'a'+k))||((c>='A')&&(c<'A'+k)))

                      putc(c+(26-k),fp2);

                  else

                         putc(c,fp2);

             }while(c!=EOF);

                  break;

 

         default:

               printf("\nYou have choose a wrong number!Please choose again!");

      }

 }

     fclose(fp1);

      fclose(fp2);

}

 

 

5.辅助运算 

(1)整数N模m的乘法逆t

  

main()

{

 unsigned n,m,t=1;

 int c;

 printf("Please enter the number:\n");

 scanf("%d,%d",&n,&m);

 while(t<65535)

 {

  c=n*t%m;

  if(c==1||c==0)

   break;

  t++;

 }

 if(t==65535||c==0)

  printf("Nicheng number is not exited!\n");

 if(c==1)

  printf("T is : %d\n",t);

 getch();

 }

 

 

(2)统计字母个数

#include "string.h"

main()

{

 int i,j,t;

 char a[80],b[26];

 int c[26];

 char e;

 printf("Please enter the letters:\n");

 gets(a);

 for(i=0;i<26;i++)

   b[i]='A'+i;

 for(i=0;i<26;i++)

  c[i]=0;

 for(j=0;j<80;j++)

  {for(i=0;i<26;i++)

   {

    if(a[j]==b[i]||a[j]==b[i]+32)

      c[i]++;

   }

  if(a[j]=='\0')

  break;

 }

 for(j=0;j<=25;j++)

  {for(i=0;i<=25;i++)

    {if(c[i]>c[i+1])

     {

      t=c[i];c[i]=c[i+1];c[i+1]=t;

      e=b[i];b[i]=b[i+1];b[i+1]=e;

     }

    }

  }

 for(i=25;i>=0;i--)

  {if(c[i]!=0)

    printf("The %c letter number is %d \n",b[i],c[i]);

  }

 getch();

}

(3)OTP加密

#include "stdio.h"

main()

{char a[80],b[80],c[80];

 int i;

 printf("Please enter the x :\n");

 gets(a);

 printf("Please enter the k :\n");

 gets(b);

 for(i=0;i<80;i++)

  c[i]=(a[i]+b[i])%26;

 printf("The result is :\n");

 for(i=0;i<80&&c[i]!='\0';i++)

   printf("%c",c[i]);

 getch();

} 

⌨️ 快捷键说明

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