#include<stdio.h> #include<conio.h>
main() { int i; window(1,1,80,25); textbackground(2); /* 定义窗口背景色 */ textcolor(1); clrscr(); gotoxy(25,4); cprintf("sort method experimentation"); gotoxy(20,8); /* 定义光标位置 */ cprintf("class: 02090403"); cprintf(" "); cprintf("finish time: 2004.7.5"); gotoxy(25,12); printf("press any key!"); if(getch()) windows(); getch(); }
windows() { window(1,1,80,25); textbackground(2); textcolor(5); clrscr(); gotoxy(24,5); cprintf("please choose:"); gotoxy(24,7); cprintf("[1]insert."); gotoxy(24,9); cprintf("[2]quick."); gotoxy(24,11); cprintf("[3]bubble."); gotoxy(24,13); cprintf("[4]select."); gotoxy(24,15); cprintf("[5]exit."); gotoxy(24,17); cprintf("[ ]"); gotoxy(25,17); }
这是定义文本窗口的程序,编译时能够通过,但运行时却出现了黑屏,我定义了 window(1,1,80,25); textbackground(2); 应该是全屏都是绿色背景,但却出现了上面是绿屏,下面是黑屏的情况,小弟实在不懂。望各位高手赐教!
----------------解决方案--------------------------------------------------------
我这里运行结果和楼主要求的一样!
----------------解决方案--------------------------------------------------------