1. 内容:学生成绩管理程序 一班有20名学生,一学期有5门课程,编写程序实现如下功能: (1) 录入每名学生

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了1. 内容:学生成绩管理程序 一班有20名学生,一学期有5门课程,编写程序实现如下功能: (1) 录入每名学生相关的知识,希望对你有一定的参考价值。

额……是用C语言编程呢

#include<graphics.h>
#include<stdlib.h>
#include<dos.h>

#define TRUE 1
#define FALSE 0
#define KB_DOWN 80 /*......define key......*/
#define KB_UP 72
#define KB_HOME 71
#define KB_END 79
#define KB_ENTER 28
#define KB_I 23
#define KB_O 24
#define KB_V 47
#define KB_F 33
#define KB_Q 16

/*......DEFINE FUCTION......*/
int get_key();
int get_item(int,int);
void setmenuback();
void input();
void output();
void view();
void cartoon();
void form();
void *buf_curse;
static int num[4][2];

void cartoon()
int height=0,width=0;
float i,j;
unsigned char *temp="THANKS.BYE!";
settextjustify(LEFT_TEXT,TOP_TEXT);
cleardevice();
for(i=1.0;i<11.0;i+=0.2)
setvisualpage(0);
setactivepage(1);
cleardevice();
ellipse(320,240,130,50,160,30);
for(j=0;j<=13;j++)
setcolor(j/2==0?LIGHTBLUE:BLACK);
ellipse(320,240,0,360,100-8*j,100);
setcolor(LIGHTBLUE);
ellipse(320,240,0,360,100-8*j,100);

setcolor(10);
setbkcolor(BLACK);
settextstyle(TRIPLEX_FONT,HORIZ_DIR,i);
outtextxy((639-width)/2,240-height/2,temp);
setvisualpage(1);
setactivepage(0);
cleardevice();
ellipse(320,240,130,50,160,30);
for(j=0;j<=13;j++)
setcolor(j/2==0?LIGHTBLUE:BLACK);
ellipse(320,240,0,360,100,100-8*j);
setcolor(LIGHTBLUE);
ellipse(320,240,0,360,100-8*j,100);

setcolor(11);
settextstyle(TRIPLEX_FONT,HORIZ_DIR,i+=0.2);
width=textwidth(temp);
height=textheight(temp);
outtextxy((639-width)/2,240-height/2,temp);


main()

int driver,mode,flag=0;
int ad[640];
int row,item_num,i,done;
float da;
unsigned size;
for(i=0;i<640;i++)
ad[i]=580/2;

/*......MENU......*/
while(!flag)

driver=VGA;
mode=VGAHI;
initgraph(&driver,&mode,"e:\\tc");
size=imagesize(0,0,90,22);
if(size!=1)
buf_curse=malloc(size);
setfillstyle(1,12);
bar(0,0,93,22);
getimage(0,0,93,22,buf_curse);
setfillstyle(1,BLACK);
bar(0,0,94,23);
setmenuback();
item_num=5;
putimage(11,91,buf_curse,XOR_PUT);
setcolor(WHITE);
row=0;
done=FALSE;
do
row=get_item(row,item_num);
switch(row)

case 0: /*......INPUT......*/
input();
break;
case 1:
output(); /*......OUTPUT......*/
break;
case 2:
view(); /*......VIEW......*/
break;
case 3:
form(); /*......FORM......*/
break;
case 4:
done=TRUE;
cartoon();
closegraph();
exit(0);

if(flag)
flag=0;
break;

while(!done);

restorecrtmode();


void setmenuback()
int k;
float l,m,n;
setcolor(YELLOW);
rectangle(0,0,639,479);
rectangle(0,457,639,479);
rectangle(0,0,116,479);
setfillstyle(1,LIGHTGRAY);
bar(1,458,638,478);
setcolor(BLACK);
outtextxy(150,466,"****** WELCOME TO USE THIS MENU ******");
setfillstyle(1,LIGHTBLUE);
setcolor(BLUE);
rectangle(10,35,104,69);
bar(11,36,104,68);
setcolor(YELLOW);
for(k=0;k<5;k++)
rectangle(10,90+k*25,104,115+k*25);
floodfill(10,90+k*25,YELLOW);

settextstyle(1,HORIZ_DIR,4);
setcolor(WHITE);
outtextxy(16,30,"MENU");
settextstyle(0,HORIZ_DIR,1);
setcolor(WHITE);
outtextxy(16,100," nput");
outtextxy(16,125," utput");
outtextxy(16,150," iew");
outtextxy(16,175," orm");
outtextxy(16,200," uit");
/*......HOT KEY......*/
setcolor(LIGHTRED);
outtextxy(16,100,"I");
outtextxy(16,125,"O");
outtextxy(16,150,"V");
outtextxy(16,175,"F");
outtextxy(16,200,"Q");
/*......TABLE LIGHT......*/
setfillstyle(1,WHITE);
setcolor(WHITE);
bar(10,437,104,439);
setfillstyle(1,DARKGRAY);
setcolor(DARKGRAY);
bar(40,431,66,437);
setcolor(WHITE);
for(l=0.0;l<=7.0;l+=0.1) circle(93,309,l);
setcolor(LIGHTGRAY);
for(m=0.0,n=0.0;m<=4.0;m+=0.4,n+=0.08) line(16+n,365,51+m,431);
for(l=0.0;l<=9.0;l+=0.3) ellipse(16,364,0,360,l-4,l);
for(m=0.0,n=0.0;m<=3.0;m+=0.3,n+=0.1) line(16+m,361,62+n,295);
for(l=0.0;l<=2.0;l+=0.4) line(62,295+l,72,294);
for(m=0.0,n=0.0;m<=9.0;m+=0.5,n+=0.05) line(67+m,292+n,73+m,298+n);
for(l=0.0;l<=20.0;l+=0.1) ellipse(94,310,45,225,l,l);


/*......INPUT......*/
void input()
int j;
setcolor(LIGHTRED);
setfillstyle(1,LIGHTBLUE);
bar(1,458,638,478);
outtextxy(5,467,"QING SHU RU NI DE 4 KE CHENG JI.");
setfillstyle(1,LIGHTBLUE);
setcolor(BLUE);
bar(190,160,530,230);
setfillstyle(1,LIGHTGREEN);
bar(190,178,530,212);
setcolor(BLACK);
outtextxy(192,195," QING SHU RU --YU WEN-- CHENG JI:");
for(j=0;j<2;j++)
num[0][j]=getch();
setcolor(RED);
outtextxy(468+j*7,195,&num[0][j]);

getch();
setfillstyle(1,LIGHTGREEN);
bar(190,178,530,212);
delay(5000);
setcolor(BLACK);
outtextxy(192,195,"QING SHU RU --SHU XUE-- CHENG JI:");
for(j=0;j<2;j++)
num[1][j]=getch();
setcolor(RED);
outtextxy(468+j*7,195,&num[1][j]);

getch();
setfillstyle(1,LIGHTGREEN);
bar(190,178,530,212);
delay(5000);
setcolor(BLACK);
outtextxy(192,195,"QING SHU RU --YING YU-- CHENG JI:");
for(j=0;j<2;j++)
num[2][j]=getch();
setcolor(RED);
outtextxy(468+j*7,195,&num[2][j]);

getch();
setfillstyle(1,LIGHTGREEN);
bar(190,178,530,212);
delay(5000);
setcolor(BLACK);
outtextxy(192,195," QING SHU RU --WU LI-- CHENG JI:");
for(j=0;j<2;j++)
num[3][j]=getch();
setcolor(RED);
outtextxy(468+j*7,195,&num[3][j]);

getch();
setcolor(LIGHTRED);
setfillstyle(1,LIGHTBLUE);
bar(1,458,638,478);
outtextxy(5,467,"OK. INPUT SUCCESS,PRESS ANY KEY TO QUIT...");
getch();
delay(2000);
setfillstyle(1,BLACK);
bar(190,160,530,230);
setfillstyle(1,LIGHTGRAY);
bar(1,458,643,478);


void output()
int i;
float m,n;
setcolor(WHITE);
for(m=0.0,n=0.0;m<=100.0;m+=0.1,n+=0.3)
line(280-m,85+n,520-m,85+n);
for(m=0.0;m<=39.0;m+=0.1)
line(435+m,340,420,385);
setcolor(BLACK);
line(520,85,420,385);
outtextxy(318,110,"---CHENG JI DAN---");
outtextxy(305,146,"XING MING : YOU");
outtextxy(283,200,"--YU WEN-- : ");
setcolor(RED);
for(i=0;i<2;i++)
outtextxy(400+i*7,200,&num[0][i]);
setcolor(BLACK);
outtextxy(274,227,"--SHU XUE--: ");
setcolor(RED);
for(i=0;i<2;i++)
outtextxy(391+i*7,227,&num[1][i]);
setcolor(BLACK);
outtextxy(265,254,"--YING YU--: ");
setcolor(RED);
for(i=0;i<2;i++)
outtextxy(382+i*7,254,&num[2][i]);
setcolor(BLACK);
outtextxy(256,281,"--WU LI-- : ");
setcolor(RED);
for(i=0;i<2;i++)
outtextxy(373+i*7,281,&num[3][i]);
setcolor(BLACK);
outtextxy(330,352,"2000:7:11");
setcolor(YELLOW);
for(m=0.0,n=0.0;m<=20.0;m+=0.1,n+=0.07)
ellipse(240,348,0,360,m-1,n);
setcolor(BROWN);
for(m=0.0,n=0.0;m<=12.0;m+=0.1,n+=0.07)
ellipse(240,348,0,360,m-1,n);
setcolor(LIGHTMAGENTA);
for(n=0.0;n<=10.0;n+=0.03)
line(236+n,350,236+n,390);
setcolor(BLACK);
for(m=0.0;m<=10.0;m+=0.01)
line(241,383,236+m,390);
getch();
setcolor(LIGHTRED);
setfillstyle(1,LIGHTBLUE);
bar(1,458,638,478);
outtextxy(5,467," PRESS ANY KEY TO QUIT...");
getch();
delay(2000);
setfillstyle(1,BLACK);
bar(150,50,600,400);
setfillstyle(1,LIGHTGRAY);
bar(1,458,643,478);


void view()
int j;
setfillstyle(1,LIGHTBLUE);
setcolor(LIGHTRED);
bar(190,160,530,230);
bar(1,458,638,478);
setfillstyle(1,LIGHTGREEN);
bar(190,178,530,212);
outtextxy(5,467,"NOW, NI ZHENG ZAI AN SHUN XU GUAN KAN GE KE CHENG JI.");
setcolor(BLACK);
outtextxy(195,195," *PRESS ANY KEY TO START...");
getch();
bar(190,178,530,212);
setcolor(BLACK);
outtextxy(195,195,"*NI DE --YU WEN-- CHENG JI WEI:");
setcolor(RED);
for(j=0;j<2;j++)
outtextxy(470+j*7,195,&num[0][j]);
delay(100000);
bar(190,178,530,212);
setcolor(BLACK);
outtextxy(195,195,"*NI DE --SHU XUE-- CHENG JI WEI:");
setcolor(RED);
for(j=0;j<2;j++)
outtextxy(470+j*7,195,&num[1][j]);
delay(100000);
bar(190,178,530,212);
setcolor(BLACK);
outtextxy(195,195,"*NI DE --YING YU-- CHENG JI WEI:");
setcolor(RED);
for(j=0;j<2;j++)
outtextxy(470+j*7,195,&num[2][j]);
delay(100000);
bar(190,178,530,212);
setcolor(BLACK);
outtextxy(195,195,"*NI DE --WU LI-- CHENG JI WEI:");
setcolor(RED);
for(j=0;j<2;j++)
outtextxy(470+j*7,195,&num[3][j]);
delay(100000);
bar(190,178,530,212);
outtextxy(192,195,"PRESS ANY KEY TO QUIT");
getch();
setfillstyle(1,BLACK);
bar(150,30,550,400);


void form()
int i;
setfillstyle(1,BLUE);
bar(1,458,638,478);
setcolor(YELLOW);
line(170,420,540,420);
line(170,60,170,420);
setcolor(WHITE);
settextstyle(1,0,1);
outtextxy(560,415,"KE MU");
settextstyle(0,0,1);
outtextxy(200,422,"YU WEN");
outtextxy(285,422,"SHU XUE");
outtextxy(370,422,"YING YU");
outtextxy(455,422," WU LI");
settextstyle(1,1,1);
outtextxy(150,80,"CHENG JI");
setfillstyle(1,LIGHTRED);
bar(210,420-num[0][0]*4,240,420);
setfillstyle(1,CYAN);
bar(295,420-num[1][0]*4,325,420);
setfillstyle(1,BLUE);
bar(380,420-num[2][0]*4,410,420);
setfillstyle(1,GREEN);
bar(465,420-num[3][0]*4,495,420);
settextstyle(0,0,1);
for(i=0;i<2;i++)
outtextxy(215+i*7,420-num[0][0]*4-10,&num[0][i]);
for(i=0;i<2;i++)
outtextxy(300+i*7,420-num[1][0]*4-10,&num[1][i]);
for(i=0;i<2;i++)
outtextxy(385+i*7,420-num[2][0]*4-10,&num[2][i]);
for(i=0;i<2;i++)
outtextxy(470+i*7,420-num[3][0]*4-10,&num[3][i]);
setfillstyle(1,BLUE);
getch();
setcolor(LIGHTRED);
outtextxy(15,466,"PRESS ANY KEY TO QUIT...");
getch();
bar(1,458,638,478);
setfillstyle(1,BLACK);
bar(150,50,635,450);


int get_item(int row,int item_num)

int key,done;
done=FALSE;
do

key=get_key();
switch(key)
case KB_DOWN:
putimage(11,91+row*25,buf_curse,XOR_PUT);
if(row==item_num-1)
row=0;
else
row+=1;
putimage(11,91+row*25,buf_curse,XOR_PUT);
break;
case KB_UP:
putimage(11,91+row*25,buf_curse,XOR_PUT);
if(row==0)
row=item_num-1;
else
row-=1;
putimage(11,91+row*25,buf_curse,XOR_PUT);
break;
case KB_ENTER:
done=TRUE;
break;
case KB_HOME:
if(row!=0);
putimage(11,91+row*25,buf_curse,XOR_PUT);
row=0;
putimage(11,91+row*25,buf_curse,XOR_PUT);

case KB_END:
if(row!=item_num-1)
putimage(11,91+row*25,buf_curse,XOR_PUT);
row=item_num-1;
putimage(11,91+row*25,buf_curse,XOR_PUT);

break;
case KB_I:
if(row!=0)
putimage(11,91+row*25,buf_curse,XOR_PUT);
row=0;
putimage(11,91+row*25,buf_curse,XOR_PUT);

done=TRUE;
break;
case KB_O:
if(row!=1)
putimage(11,91+row*25,buf_curse,XOR_PUT);
row=1;
putimage(11,91+row*25,buf_curse,XOR_PUT);

done=TRUE;
break;
case KB_V:
if(row!=2)
putimage(11,91+row*25,buf_curse,XOR_PUT);
row=2;
putimage(11,91+row*25,buf_curse,XOR_PUT);

done=TRUE;
break;
case KB_F:
if(row!=3)
putimage(11,91+row*25,buf_curse,XOR_PUT);
row=3;
putimage(11,91+row*25,buf_curse,XOR_PUT);

done=TRUE;
break;
case KB_Q:
if(row!=4)
putimage(11,91+row*25,buf_curse,XOR_PUT);
row=4;
putimage(11,91+row*25,buf_curse,XOR_PUT);

done=TRUE;
break;
defaule:break;

while(!done);
return row;


int get_key()

union REGS rg;
rg.h.ah=0;
int86(0x16,&rg,&rg);
return rg.h.ah;

int show(int ch,int n)
int a;
a=(int)(10*(ch/2+1)*sin(2*3.14*n*(ch/2+2)/630));
return a;
参考技术A 用Wd软件竖写学生横写科目,成绩照填就OK了

以上是关于1. 内容:学生成绩管理程序 一班有20名学生,一学期有5门课程,编写程序实现如下功能: (1) 录入每名学生的主要内容,如果未能解决你的问题,请参考以下文章

1038 统计同成绩学生 (20 分)

1038. 统计同成绩学生(20)

1038 统计同成绩学生(20 分)

P 1038 统计同成绩学生

PAT乙级1038

学生成绩管理--功能全--较难