主题:[原创]学生信息管理(c)---绝对原创(5)
void showMenu(int num,char *menuChar[])
{
int i,m,key,y=4,q=8;
window(1,2,80,2);
puttext(2+menuLine*8,2,9+menuLine*8,2,buf2);
if(num==5) m=0,menuLine=0;
else m=8,menuLine=1;
gettext(2+menuLine*8,2,9+menuLine*8,2,buf2);
textbackground(0);
textcolor(15);
gotoxy(2+menuLine*8,1);
cprintf("%s",menu[menuLine]);
gettext(1+m,3,15+m,8,buf);
window(1+m,3,15+m,8);
textbackground(15);
textcolor(0);
clrscr();
window(1+m,3,15+m,10);
box(1,1,7,15);
for(i=4;i<q+1;i++)
{
gotoxy(2,i-2);
cprintf("%s",menuChar[i-4]);
}
gettext(1+m,4,14+m,4,buf1);
textbackground(0);
textcolor(15);
gotoxy(2,2);
cprintf("%s",menuChar[0]);
key=bioskey(0);
while(key!=KEY_ALT_X&&key!=KEY_ENTER&&key!=KEY_ESC&&key!=KEY_RIGHT)
{
if(key==KEY_UP||key==KEY_DOWN);
{
puttext(1+m,y,14+m,y,buf1);
gotoxy(2,y-2);
if(key==KEY_UP)y=y==4?q:y-1;
if(key==KEY_DOWN)y=y==q?4:y+1;
gettext(1+m,y,14+m,y,buf1);
gotoxy(2,y-2);
textbackground(0);
textcolor(15);
cprintf("%s",menuChar[y-4]);
gotoxy(2,y-2);
}
key=bioskey(0);
}
if(key==KEY_ENTER)
{ seleteOperation(m,y); }
else
{
textbackground(3);
clrscr();
window(1+m,3,15+m,10);
puttext(1,3,80,21,buf3);
}
window(1,3,80,24);
gotoxy(1,1);
}
void ver(void)
{
int key;
window(1,2,80,2);
puttext(2+menuLine*8,2,9+menuLine*8,2,buf2);
menuLine=2;
gettext(2+menuLine*8,2,9+menuLine*8,2,buf2);
textbackground(0);
textcolor(15);
gotoxy(2+menuLine*8,1);
cprintf("%s",menu[menuLine]);
textbackground(15);
textcolor(0);
window(20,8,50,20);
clreol();
box(1,1,12,31);
gotoxy(2,2);
cprintf("*********Information*********");
gotoxy(2,3);
cprintf("Producer: ");
gotoxy(2,4);
cprintf(" Wilm.Gu ");
gotoxy(2,5);
cprintf("Programming Start Time: ");
gotoxy(2,6);
cprintf(" 23/03/04 ");
gotoxy(2,7);
cprintf("Programming End Time: ");
gotoxy(2,8);
cprintf(" 27/04/04 ");
gotoxy(2,9);
cprintf("Version: v1.0 ");
gotoxy(2,10);
cprintf(" ");
gotoxy(2,11);
cprintf(" ");
key=bioskey(0);
if(key==KEY_ESC)
{
textbackground(3);
clrscr();
window(20,8,50,20);
puttext(1,3,80,21,buf3);
}
textbackground(3);
clrscr();
window(20,8,50,20);
puttext(1,3,80,21,buf3);
window(1,3,80,24);
gotoxy(1,1);
}
void showFan(int fan)
{
window(1,2,80,2);
if(fan==3)
{
if(menuLine==0)
{ showMenu(5,f);return; }
if(menuLine==1)
{ showMenu(4,e);return; }
if(menuLine==2)
{ ver();return; }
}
puttext(2+menuLine*8,2,9+menuLine*8,2,buf2);
switch(fan)
{
case 1:menuLine=menuLine==0?2:menuLine-1;break;
case 2:menuLine=menuLine==2?0:menuLine+1;break;
default:break;
}
gettext(2+menuLine*8,2,9+menuLine*8,2,buf2);
textbackground(0);
textcolor(15);
gotoxy(2+menuLine*8,1);
cprintf("%s",menu[menuLine]);
}
void test(int key)
{
gettext(1,3,80,21,buf3);
if(key==PAGE_UP)
{ showPage(1); }
if(key==PAGE_DOWN)
{ showPage(2); }
if(key==KEY_LEFT)
{ showFan(1); }
if(key==KEY_RIGHT)
{ showFan(2); }
if(key==KEY_DOWN)
{ showFan(3); }
if(key==KEY_ALT_X)
{ quitSure(); }
if(key==KEY_ALT_F)
{ showMenu(5,f); }
if(key==KEY_ALT_E)
{ showMenu(4,e); }
if(key==KEY_ALT_A)
{ ver(); }
if(key==KEY_ESC)
{ quitSure(); }
}
main ()
{
int key;
showTitle();
pageCount=1;
showPageCount();
while(1)
{
key=0;
while(bioskey(1)==0)
{
key=bioskey(0);
test(key);
}
}
}
{
int i,m,key,y=4,q=8;
window(1,2,80,2);
puttext(2+menuLine*8,2,9+menuLine*8,2,buf2);
if(num==5) m=0,menuLine=0;
else m=8,menuLine=1;
gettext(2+menuLine*8,2,9+menuLine*8,2,buf2);
textbackground(0);
textcolor(15);
gotoxy(2+menuLine*8,1);
cprintf("%s",menu[menuLine]);
gettext(1+m,3,15+m,8,buf);
window(1+m,3,15+m,8);
textbackground(15);
textcolor(0);
clrscr();
window(1+m,3,15+m,10);
box(1,1,7,15);
for(i=4;i<q+1;i++)
{
gotoxy(2,i-2);
cprintf("%s",menuChar[i-4]);
}
gettext(1+m,4,14+m,4,buf1);
textbackground(0);
textcolor(15);
gotoxy(2,2);
cprintf("%s",menuChar[0]);
key=bioskey(0);
while(key!=KEY_ALT_X&&key!=KEY_ENTER&&key!=KEY_ESC&&key!=KEY_RIGHT)
{
if(key==KEY_UP||key==KEY_DOWN);
{
puttext(1+m,y,14+m,y,buf1);
gotoxy(2,y-2);
if(key==KEY_UP)y=y==4?q:y-1;
if(key==KEY_DOWN)y=y==q?4:y+1;
gettext(1+m,y,14+m,y,buf1);
gotoxy(2,y-2);
textbackground(0);
textcolor(15);
cprintf("%s",menuChar[y-4]);
gotoxy(2,y-2);
}
key=bioskey(0);
}
if(key==KEY_ENTER)
{ seleteOperation(m,y); }
else
{
textbackground(3);
clrscr();
window(1+m,3,15+m,10);
puttext(1,3,80,21,buf3);
}
window(1,3,80,24);
gotoxy(1,1);
}
void ver(void)
{
int key;
window(1,2,80,2);
puttext(2+menuLine*8,2,9+menuLine*8,2,buf2);
menuLine=2;
gettext(2+menuLine*8,2,9+menuLine*8,2,buf2);
textbackground(0);
textcolor(15);
gotoxy(2+menuLine*8,1);
cprintf("%s",menu[menuLine]);
textbackground(15);
textcolor(0);
window(20,8,50,20);
clreol();
box(1,1,12,31);
gotoxy(2,2);
cprintf("*********Information*********");
gotoxy(2,3);
cprintf("Producer: ");
gotoxy(2,4);
cprintf(" Wilm.Gu ");
gotoxy(2,5);
cprintf("Programming Start Time: ");
gotoxy(2,6);
cprintf(" 23/03/04 ");
gotoxy(2,7);
cprintf("Programming End Time: ");
gotoxy(2,8);
cprintf(" 27/04/04 ");
gotoxy(2,9);
cprintf("Version: v1.0 ");
gotoxy(2,10);
cprintf(" ");
gotoxy(2,11);
cprintf(" ");
key=bioskey(0);
if(key==KEY_ESC)
{
textbackground(3);
clrscr();
window(20,8,50,20);
puttext(1,3,80,21,buf3);
}
textbackground(3);
clrscr();
window(20,8,50,20);
puttext(1,3,80,21,buf3);
window(1,3,80,24);
gotoxy(1,1);
}
void showFan(int fan)
{
window(1,2,80,2);
if(fan==3)
{
if(menuLine==0)
{ showMenu(5,f);return; }
if(menuLine==1)
{ showMenu(4,e);return; }
if(menuLine==2)
{ ver();return; }
}
puttext(2+menuLine*8,2,9+menuLine*8,2,buf2);
switch(fan)
{
case 1:menuLine=menuLine==0?2:menuLine-1;break;
case 2:menuLine=menuLine==2?0:menuLine+1;break;
default:break;
}
gettext(2+menuLine*8,2,9+menuLine*8,2,buf2);
textbackground(0);
textcolor(15);
gotoxy(2+menuLine*8,1);
cprintf("%s",menu[menuLine]);
}
void test(int key)
{
gettext(1,3,80,21,buf3);
if(key==PAGE_UP)
{ showPage(1); }
if(key==PAGE_DOWN)
{ showPage(2); }
if(key==KEY_LEFT)
{ showFan(1); }
if(key==KEY_RIGHT)
{ showFan(2); }
if(key==KEY_DOWN)
{ showFan(3); }
if(key==KEY_ALT_X)
{ quitSure(); }
if(key==KEY_ALT_F)
{ showMenu(5,f); }
if(key==KEY_ALT_E)
{ showMenu(4,e); }
if(key==KEY_ALT_A)
{ ver(); }
if(key==KEY_ESC)
{ quitSure(); }
}
main ()
{
int key;
showTitle();
pageCount=1;
showPageCount();
while(1)
{
key=0;
while(bioskey(1)==0)
{
key=bioskey(0);
test(key);
}
}
}