毕业论文论文范文课程设计实践报告法律论文英语论文教学论文医学论文农学论文艺术论文行政论文管理论文计算机安全
您现在的位置: 毕业论文 >> 课程设计 >> 正文

C语言课程设计报告_下拉菜单程序

更新时间:2007-10-22:  来源:毕业论文
C语言课程设计报告_下拉菜单程序|c语言程序代码编程小程序设计|c语言课程设计报告课程案例

#include <process.h>
#include <stdlib.h>
#include <stdio.h>
#include <dos.h>
#include <conio.h>
#define key_down 80
#define key_up 72
#define key_esc 1
#define key_alt_f 33
#define key_alt_x 45
#define key_enter 28

int get_key();
void box(int startx,int stary,int high,int width);
main()
{
int i,key,x,y,l;
char *menu[]={"File","Edit","Run","Options","Help","Setup","Zoom","Menu"};
char *red[]={"F","E","R","O","H","S","Z","M"};
char *f[]={"Load file", "Save file","Print ","Modify ",
"Quit alt_x "};
char buf[16*10*2],buf1[16*2];
while(1)
{
textbackground(1);
clrscr();
window(1,1,80,1);
textbackground(15);
textcolor(0);
clrscr();
window(1,1,80,2);
for(i=0,l=0;i<8;i++)
{
x=wherex();
y=wherey();
cprintf(" %s",menu[i]);
l=strlen(menu[i]);
gotoxy(x,y);
textcolor(RED);
cprintf(" %s",red[i]);
x=x+l+4;
gotoxy(x,y);
textcolor(BLACK);
}
x=0;
key=0;
while (bioskey(1)==0);
key=get_key();
if(key==key_alt_x)exit(0);
if(key==key_alt_f)
{
textbackground(0);
textcolor(15);
gotoxy(2,1);
cprintf("%s",menu[0]);
gettext(4,2,18,12,buf);
window(4,2,19,8);
textbackground(15);
textcolor(0);
clrscr();
window(4,2,19,9);
box(1,1,7,16);
for(i=2; i<7;i++)
{
gotoxy(2,i);
cprintf("%s",f[i-2]);
}
gettext(2,2,18,3,buf1);
textbackground(0);
textcolor(15);
gotoxy(2,2);
cprintf("%s",f[0]);
y=2;
key=get_key();
while(key!=key_alt_x&&key!=key_enter&&key!=key_esc)
{
if(key==key_up||key==key_down)
{
puttext(2,y,18,y+1,buf1);
if(key==key_up)
y=y==2? 6:y-1;
if(key==key_down)
y=y==6? 2:y+1;
gettext(2,y,18,y+1,buf1);
textbackground(0);
textcolor(15);
gotoxy(2,y);
cprintf("%s",f[y-2]);
}
key=get_key();
}
if(key==key_alt_x)
exit(0);
if(key==key_enter)
{
switch(y-1)
{
case 1: break;
case 2: break;
case 3: break;
case 4: break;
case 5: exit(0);
default: break;
}
}
else
{window(1,1,80,2);
puttext(4,2,19,10,buf);
textbackground(15);
textcolor(0);
gotoxy(2,1);
cprintf("%s",menu[0]);
}
}
}
}

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

void box(int startx,int starty,int high,int width)
{
int i;
gotoxy(startx,starty);
putch(0xda);
for (i=startx+1;i<width;i++)
putch(0xc4);
putch(0xbf);
for(i=starty+1;i<high;i++)
{
gotoxy(startx,i);
putch(0xb3);
gotoxy(width,i);
putch(0xb3);
}
gotoxy(startx+1,width);
putch(0xc0);
for(i=startx+1;i<width;i++)
putch(0xc4);
putch(0xd9);
return;
}

C语言课程设计报告_下拉菜单程序下载如图片无法显示或论文不完整,请联系qq752018766
设为首页 | 联系站长 | 友情链接 | 网站地图 |

copyright©751com.cn 辣文论文网 严禁转载
如果本毕业论文网损害了您的利益或者侵犯了您的权利,请及时联系,我们一定会及时改正。