C++经典算法题-Press any key to change color, do you want to try it. Please hurry up!

2022-11-30 08:27:12 浏览数 (1)

1. 题目

题目:Press any key to change color, do you want to try it. Please hurry up!

2. 代码示例
代码语言:javascript复制
#include <conio.h>
    void main(void)
    {
        int color;
        for (color = 0; color < 8; color  )
        {
            textbackground(color); /*设置文本的背景颜色*/
            cprintf("This is color %drn", color);
            cprintf("ress any key to continuern");
            getch(); /*输入字符看不见*/
        }
    }
key

0 人点赞