fuopen

 

C语言函数textcolor

函数名: textcolor

 

  功 能: 在文本模式中选择新的字符颜色

 

  用 法: void textcolor(int newcolor);

 

  参数说明:其中参数newcolor为要设置的颜色,它的取值可以是下面的符号常量:

 

  

BLACK BLUE GREEN CYAN
RED MAGENTA BROWN LIGHTGRAY
DARKGRAY LIGHTBLUE LIGHTGREEN LIGHTCYAN
LIGHTRED LIGHTMAGENTA YELLOW WHITE
 

  程序例1:(一个很经典的程序例程)

 

  #include <conio.h>

 

  int main(void)

 

  {

 

  int i, j;

 

  clrscr();

 

  for (i=0; i<9; i++)

 

  {

 

  for (j=0; j<80; j++)

 

  cprintf("C");

 

  cprintf("\r\n");

 

  textcolor(i+1);

 

  }

 

  return 0;

 

  }

 

  程序例2:

 

  #include <conio.h>

 

  int main(void)

 

  {

 

  int i;

 

  for (i=0; i<15; i++)

 

  {

 

  textcolor(i);

 

  cprintf("Foreground Color\r\n");

 

  }

 

  return 0;

 

  }

 

  在VC中的conio.h中无此函数。

 

posted on 2012-04-23 11:19  fuopen  阅读(1518)  评论(0)    收藏  举报

导航