menu.c

来自「设计一个学生成绩管理系统」· C语言 代码 · 共 49 行

C
49
字号
#include"jinhe.h"
int menu_select()
{ char *menu[]={"Welcome to our class",
		"*************MAIN***MENU************",
		"    0. List all",
		"    1. Add some imformation",
		"    2. Search",
		"    3. Sort",
		"    4. Insert",
		"    5. Delete",
		"    6. Creat new ",
		"    7. Quit",
		"************************************",
		"Up and down with      press enter OK"};
  int i,key=0,c=0;
  clrscr();
  textbackground(BLUE);
  broder(16,3,53,16);
  window(17,4,52,15);
  clrscr();
  for(i=0;i<12;i++)
   {   gotoxy(1,1+i);
     printf("%s",menu[i]);
   }
  gotoxy(18,12);putch(24);
  gotoxy(20,12);putch(25);
  i=2;
  gotoxy(1,3);
  textbackground(LIGHTGREEN);
  cprintf("%s",menu[2]);
  gotoxy(1,3);
  while(key!=13)
   { while(bioskey(1)==0);
     key=bioskey(0);
     key=key&0Xff?key&0Xff:key>>8;
     gotoxy(1,i+1);
     textbackground(BLUE);
     cprintf("%s",menu[i]);
     if(key==72) i=i==2?9:i-1;
     if(key==80) i=i==9?2:i+1;
     gotoxy(1,i+1);
     textbackground(LIGHTGREEN);
     cprintf("%s",menu[i]);
     c=i-2;
   }
  textbackground(BLUE);
  window(1,1,80,25);
  return(c);
}

⌨️ 快捷键说明

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