📄 图形式下拉菜单.txt
字号:
gotoxy(6,18); printf("%ld",mnote[k].num);
gotoxy(6+9*1,18); printf("%s",mnote[k].name);
for(j=0;j<5;j++)
{gotoxy(6+9*(j+2),18);
printf("%.1f",mnote[k].court[j]);
}
gotoxy(6+9*7,18); printf("%.1f",mnote[k].aver);
}
if(x==0&&y==0)
{clearblue();
setcolor(YELLOW);
settextstyle(1,0,2);
settextjustify(1,1);
outtextxy(320,240,"the student is not exist!!");
}
getch();
clearblue();
}
/******************************************/
void new_old_file(void)
{
char temp1[20],temp2[20],c,i;
setcolor(RED);
setfillstyle(SOLID_FILL,GREEN);
bar3d(90,140,540,340,5,1);
settextstyle(1,0,2);
settextjustify(1,1);
outtextxy(320,170,"Students' Datas filename----Press 1");
outtextxy(320,220,"students' Marks filename----Press 2");
outtextxy(320,270,"else to continue");
i=getch();
clearblue();
setfillstyle(SOLID_FILL,GREEN);
bar(100,140,540,340);
setfillstyle(SOLID_FILL,BLUE);
bar(230,222,410,246);
gotoxy(32,15);
if((i-'1')==0)
{outtextxy(320,200,"Input Students' datas filename");
gets(temp1);
setcolor(YELLOW);
setfillstyle(SOLID_FILL,GREEN);
bar(100,140,540,340);
setcolor(RED);
settextstyle(TRIPLEX_FONT,HORIZ_DIR,1);
settextjustify(CENTER_TEXT,CENTER_TEXT);
outtextxy(320,240,"Sure Y/else to continue");
c=getch();
if(c=='Y'||c=='y')
strcpy(d,temp1);
}
if((i-'2')==0)
{outtextxy(320,200,"Input Students' marks filename");
gets(temp2);
setcolor(YELLOW);
setfillstyle(SOLID_FILL,GREEN);
bar(100,140,540,340);
setcolor(RED);
settextstyle(TRIPLEX_FONT,HORIZ_DIR,1);
settextjustify(CENTER_TEXT,CENTER_TEXT);
outtextxy(320,240,"Sure Y/else to continue");
c=getch();
if(c=='Y'||c=='y')
strcpy(m,temp2);
}
clearblue();
return;
}
/********************************************/
void lookfile(void)
{setcolor(RED);
setfillstyle(SOLID_FILL,GREEN);
bar3d(90,140,540,340,5,1);
settextstyle(1,0,2);
settextjustify(1,1);
setcolor(BLUE);
outtextxy(320,160,"Students' Datas Last filename");
outtextxy(320,260,"students' Marks Last filename");
setcolor(RED);
outtextxy(320,200,d);
outtextxy(320,300,m);
getch();
clearblue();
return;
}
/*************************************************/
void good(void) /*平均分在85分以上为good*/
{struct mark temp1[10],temp2[10];
int i,j=0;
mark(temp1);mark(temp2);
loadmark(temp1);
for(i=0;temp1[i].num!=0&&i<10;i++)
if(temp1[i].aver>=85)
{temp2[j]=temp1[i];
j++;
}
if(j>0)
{students_mark(temp2);
setcolor(YELLOW);
setfillstyle(SOLID_FILL,CYAN);
bar(10,110,630,140);
settextjustify(1,1);
outtextxy(320,125,"========Student who is Good!!========");
}
else
{setcolor(YELLOW);
settextstyle(1,0,2);
settextjustify(1,1);
outtextxy(320,220,"No Student is Good!!");
outtextxy(320,260,"It is a bad thing!!");
}
getch();
clearblue();
}
/***********************************************/
void bad(void) /*有一科不及格就为bad*/
{struct mark temp1[10],temp2[10];
int i,j=0,k;
mark(temp1);mark(temp2);
loadmark(temp1);
for(i=0;temp1[i].num!=0&&i<10;i++)
for(k=0;k<5;k++)
if(temp1[i].court[k]<60)
{temp2[j]=temp1[i];
j++;
break;
}
if(j>0)
{students_mark(temp2); /*输出temp2中的数据*/
setcolor(YELLOW);
setfillstyle(SOLID_FILL,CYAN);
bar(10,110,630,140);
settextjustify(1,1);
outtextxy(320,125,"========Student who is Bad Luck!!========");
}
else
{setcolor(YELLOW);
settextstyle(1,0,2);
settextjustify(1,1);
outtextxy(320,220,"No Student is Bad Luck!!");
outtextxy(320,260,"It is a pleasure thing!!");
}
getch();
clearblue();
}
/**************************************************/
void delect(void)
{struct student temp1[10];
struct mark temp2[10];
FILE *fpdata,*fpmark;
int i,j,k,x=0,y=0,num;
char c,tt[40];
data(temp1);mark(temp2);
loaddata(temp1);loadmark(temp2);
setcolor(RED);
setfillstyle(SOLID_FILL,GREEN);
fillellipse(320,240,150,100);
settextstyle(1,0,2);
settextjustify(1,1);
outtextxy(320,200,"Input Num");
setfillstyle(SOLID_FILL,BLUE);
bar(270,222,380,246);
gotoxy(37,15);
gets(tt);num=atol(tt);
clearblue();
setcolor(YELLOW);
setfillstyle(SOLID_FILL,GREEN);
bar(130,140,510,340);
settextstyle(1,0,2);
settextjustify(1,1);
outtextxy(320,190,"Delect student Data--Press 1");
outtextxy(320,290,"Delect student Mark--Press 2");
c=getch();
clearblue();
if(c=='1')
{for(i=0;temp1[i].num!=0&&i<10;i++)
if(temp1[i].num==num)
{x++;
break;
}
for(j=i;temp1[i].num!=0&&i<9;j++,i++)
temp1[j]=temp1[i+1]; /*第i项为所要删除项i+1项赋给i项将第i项覆盖*/
temp1[j].num=0;
if(x==0)
{outtextxy(320,240,"the student is not exist!!");
getch();
clearblue();
return;
}
bar(170,200,370,280);
outtextxy(320,205,"Are you Sure to Delect??");
outtextxy(320,245,"Sure Y/else to continue");
c=getch();
if(c=='y'||c=='Y')
{unlink(d);
if((fpdata=fopen(d,"wb"))==NULL)
{outtextxy(320,220,"Cannot open this file");
outtextxy(320,250,"Please try again!!");
getch();
clearblue();
return;
}
rewind(fpdata);
for(i=0;temp1[i].num!=0&&i<10;i++)
fwrite(&temp1[i],sizeof(struct student),1,fpdata);
fclose(fpdata);
}
clearblue();
return;
}
if(c=='2')
{for(i=0;temp2[i].num!=0&&i<10;i++)
if(temp2[i].num==num)
{y++;
break;
}
for(k=i;temp2[i].num!=0&&i<9;k++,i++)
temp2[k]=temp2[i+1];
temp2[k].num=0;
if(y==0)
{outtextxy(320,240,"the student is not exist!!");
getch();
clearblue();
return;
}
bar(170,200,370,280);
outtextxy(320,205,"Are you Sure to Delect??");
outtextxy(320,245,"Sure Y/else to continue");
c=getch();
if(c=='y'||c=='Y')
{unlink(m);
if((fpmark=fopen(m,"wb"))==NULL)
{outtextxy(320,220,"Cannot open this file");
outtextxy(320,250,"Please try again!!");
getch();
clearblue();
return;
}
rewind(fpmark);
for(i=0;temp2[i].num!=0&&i<10;i++)
fwrite(&temp2[i],sizeof(struct mark),1,fpmark);
fclose(fpmark);
}
clearblue();
return;
}
return;
}
/************************************************/
void modify(void)
{int i,j,k,x=0,y=0;
long int num;
char c,tt[40];
struct student temp1[10];
struct mark temp2[10];
FILE *fpdata,*fpmark;
char *dataitem[]={"Number","Name","Class(1--3)","Sex","Age","Address","Telephone"};
char *markitem[]={"Num","Name","English","Math","Phyics","Computer","C language"};
data(temp1);mark(temp2);
loaddata(temp1);loadmark(temp2);
setcolor(RED);
setfillstyle(SOLID_FILL,GREEN);
fillellipse(320,240,150,100);
settextstyle(1,0,2);
settextjustify(1,1);
outtextxy(320,200,"Input Num");
setfillstyle(SOLID_FILL,BLUE);
bar(270,222,380,246);
gotoxy(37,15);
gets(tt);num=atol(tt);
for(j=0;temp1[j].num!=0&&j<10;j++)
if(temp1[j].num==num) x=j+1;
for(j=0;temp2[j].num!=0&&j<10;j++)
if(temp2[j].num==num) y=j+1;
if(x==0&&y==0)
{clearblue();
setcolor(YELLOW);
outtextxy(320,200,"The student is not exist!!");
getch();
clearblue();
return;
}
clearblue();
setcolor(YELLOW);
setfillstyle(SOLID_FILL,GREEN);
bar(130,140,510,340);
settextstyle(1,0,2);
settextjustify(1,1);
outtextxy(320,190,"Modify student Data--Press 1");
outtextxy(320,290,"Modify student Mark--Press 2");
c=getch();
clearblue();
if(c=='1')
{
setcolor(RED);
setfillstyle(SOLID_FILL,LIGHTGRAY);
settextstyle(TRIPLEX_FONT,HORIZ_DIR,1);
settextjustify(RIGHT_TEXT,CENTER_TEXT);
bar(210,180,430,450);
for(i=0;i<7;i++)
{ outtextxy(320,190+i*30+15,dataitem[i]) ;
setfillstyle(SOLID_FILL,BLACK);
bar(323,177+i*30+15,420,180+i*30+37);
}
settextjustify(CENTER_TEXT,CENTER_TEXT);
setcolor(YELLOW);
outtextxy(290,150,"Please input the Information");
setcolor(RED);
gotoxy(42,13);
printf("%ld",num);
gotoxy(42,13+1*2);
gets(temp1[x-1].name);
gotoxy(42,13+2*2);
gets(tt);temp1[x-1].class=atoi(tt);
gotoxy(42,13+3*2);
gets(temp1[x-1].sex);
gotoxy(42,13+4*2);
gets(tt);temp1[x-1].age=atoi(tt);
gotoxy(42,13+5*2);
gets(temp1[x-1].add);
gotoxy(42,13+6*2);
gets(tt);temp1[x-1].tel=atol(tt);
clearblue();
bar(170,200,370,280);
settextjustify(1,1);
setcolor(YELLOW);
outtextxy(320,205,"Are you Sure to Modify??");
outtextxy(320,245,"Sure Y/else to continue");
c=getch();
if(c=='y'||c=='Y')
{unlink(d);
if((fpdata=fopen(d,"wb"))==NULL)
{outtextxy(320,220,"Cannot open this file");
outtextxy(320,250,"Please try again!!");
getch();
clearblue();
return;
}
rewind(fpdata);
for(i=0;temp1[i].num!=0&&i<10;i++)
fwrite(&temp1[i],sizeof(struct student),1,fpdata);
fclose(fpdata);
}
clearblue();
return;
}
if(c=='2')
{
setcolor(RED);
setfillstyle(SOLID_FILL,LIGHTGRAY);
settextstyle(TRIPLEX_FONT,HORIZ_DIR,1);
settextjustify(RIGHT_TEXT,CENTER_TEXT);
bar(210,180,430,450);
for(i=0;i<7;i++)
{ outtextxy(320,190+i*30+15,markitem[i]) ;
setfillstyle(SOLID_FILL,BLACK);
bar(323,177+i*30+15,420,180+i*30+37);
}
settextjustify(CENTER_TEXT,CENTER_TEXT);
setcolor(YELLOW);
outtextxy(290,150,"Please input the court Mark");
setcolor(RED);
gotoxy(42,13);
printf("%ld",num);
gotoxy(42,13+1*2);
gets(temp2[y-1].name);
for(k=0;k<5;k++)
{gotoxy(42,13+(k+2)*2);
gets(tt);temp2[y-1].court[k]=atof(tt);
}
clearblue();
bar(170,200,370,280);
settextjustify(1,1);
setcolor(YELLOW);
outtextxy(320,205,"Are you Sure to Modify??");
outtextxy(320,245,"Sure Y/else to continue");
c=getch();
if(c=='Y'||c=='y')
{unlink(m);
if((fpmark=fopen(m,"wb"))==NULL)
{outtextxy(320,220,"Cannot open this file");
outtextxy(320,250,"Please try again!!");
getch();
clearblue();
return;
}
rewind(fpmark);
for(i=0;temp2[i].num!=0&&i<10;i++)
fwrite(&temp2[i],sizeof(struct mark),1,fpmark);
fclose(fpmark);
}
clearblue();
return;
}
}
/**************************************/
void begin(void)
{int i,j;
setfillstyle(SOLID_FILL,GREEN);
bar(0,0,260,479);
bar(430,0,589,400);
setfillstyle(SOLID_FILL,LIGHTRED);
bar(260,0,380,479);
for(j=0;j<35;j++)
{
setcolor(j);
settextstyle(1,0,8);
settextjustify(1,1);
outtextxy(320,240+(j*3)%5,"welcome you to usee this!!");
for(i=0;i<40;i++)
{
setcolor(i%6);
ellipse(320,40,0,360,i,20);
ellipse(130,178,0,360,i,20);
ellipse(510,178,0,360,i,20);
ellipse(202,402,0,360,i,20);
ellipse(438,402,0,360,i,20);
setcolor(LIGHTRED);
ellipse(320,40,0,360,i*3/5,20);
setcolor(GREEN);
ellipse(130,178,0,360,i*3/5,20);
ellipse(510,178,0,360,i*3/5,20);
ellipse(202,402,0,360,i*3/5,20);
ellipse(438,402,0,360,i*3/5,20);
}
for(;i>=0;i--)
{
setcolor(LIGHTRED);
ellipse(320,40,0,360,i,20);
setcolor(GREEN);
ellipse(130,178,0,360,i,20);
ellipse(510,178,0,360,i,20);
ellipse(202,402,0,360,i,20);
ellipse(438,402,0,360,i,20);
setcolor(i%6);
ellipse(320,40,0,360,i*3/5,20);
ellipse(130,178,0,360,i*3/5,20);
ellipse(510,178,0,360,i*3/5,20);
ellipse(202,402,0,360,i*3/5,20);
ellipse(438,402,0,360,i*3/5,20);;
}
}
cleardevice();
}
/************************************/
void end(void)
{ int i,j;
cleardevice();
setfillstyle(SOLID_FILL,GREEN);
bar(0,0,639,240);
setfillstyle(SOLID_FILL,YELLOW);
bar(0,240,639,479);
setfillstyle(SOLID_FILL,WHITE);
bar(170,200,470,280);
for(j=0;j<6;j++)
{
for(i=0;i<80;i++)
{
setcolor(i%6);
ellipse(100,100,0,360,i,90);
ellipse(540,100,0,360,90,i);
ellipse(100,380,0,360,90,i);
ellipse(540,380,0,360,i,90);
setcolor(GREEN);
ellipse(100,100,0,360,i*3/5,90);
ellipse(540,100,0,360,90,i*3/5);
setcolor(YELLOW);
ellipse(100,380,0,360,90,i*3/5);
ellipse(540,380,0,360,i*3/5,90);
}
setcolor(j+2);
settextjustify(1,1);
settextstyle(1,0,6);
outtextxy(320,240+j*3%5,"GoodBye!!");
settextstyle(1,0,3);
setcolor(j+1);
outtextxy(100,100,"Thank");
outtextxy(540,100,"You");
outtextxy(100,380,"For");
outtextxy(540,380,"Viewing");
for(;i>=0;i--)
{
setcolor(GREEN);
ellipse(100,100,0,360,i,90);
ellipse(540,100,0,360,90,i);
setcolor(YELLOW);
ellipse(100,380,0,360,90,i);
ellipse(540,380,0,360,i,90);
setcolor(i%3);
ellipse(100,100,0,360,i*3/5,90);
ellipse(540,100,0,360,90,i*3/5);
ellipse(100,380,0,360,90,i*3/5);
ellipse(540,380,0,360,i*3/5,90);
}
}
closegraph();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -