给你一段代码参考一下
这是宏义
#define LEFT 0x4b
#define RIGHT 0x4d
#define UP 0x48
#define DOWN 0x50
#define ESC 0x1b
下面是一段代码
do
{
//key=bioskey(0);
key=getch();
switch(key)
{
case LEFT:
p->month--;
p->month<1?p->month=12-p->month,p->year--:p->month;
print_date(p->year,p->month ,1);
printf("\n");
break;
case RIGHT:
p->month++;
p->month>12?p->month=p->month-12,p->year++:p->month;
print_date(p->year,p->month , 1);
printf("\n");
break;
case UP:
p->year++;
print_date(p->year,p->month , 1);
printf("\n");
break;
case DOWN:
p->year--;
print_date(p->year,p->month , 1);
printf("\n");
break;
}
}while(key != ESC);