page contents

C语言趣味小题目

题目:按任意键改变颜色

题目:按任意键改变颜色

1.程序分析:按任意键改变颜色,设置文本的背景颜色           

2.程序源代码:

#include <stdio.h>

#include <conio.h>

void main(void)

{

  int color;

  for (color = 0; color < 8; color++)

  {

    textbackground(color);/*设置文本的背景颜色*/

    cprintf("This is color %d\r\n", color);

    cprintf("Press any key to continue\r\n");

    getch();/*输入字符看不见*/

  }

}

  • 发表于 2021-08-09 16:45
  • 阅读 ( 404 )
  • 分类:C/C++开发

你可能感兴趣的文章

相关问题

0 条评论

请先 登录 后评论
文双
文双

NB

71 篇文章

作家榜 »

  1. 轩辕小不懂 2403 文章
  2. Pack 1131 文章
  3. 小柒 1046 文章
  4. Nen 576 文章
  5. 王昭君 209 文章
  6. 文双 71 文章
  7. 小威 64 文章
  8. Cara 36 文章