C语言:窗口控制台颜色改变(不断换色)
了解了stdlib头文件中的system 函数之后突发奇想想要做一个蹦迪效果后台
代码如下:
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main ()
{
long time;
while(1)//死循环
{
for(time = 0; time < 3; time++)
system("color A8");
Sleep(50);
for(time = 0; time < 3; time++)
system("color B8");
Sleep(50);
for(time = 0; time < 3; time++)
system("color C8");
Sleep(50);
for(time = 0; time < 3; time++)
system("color D8");
Sleep(50);
for(time = 0; time < 3; time++)
system("color E8");
Sleep(50);
for(time = 0; time < 3; time++)
system("color D8");
Sleep(50);
for(time = 0; time < 3; time++)
system("color E8");
Sleep(50);
for(time = 0; time < 3; time++)
system("color F8");
Sleep(50);
}
return 0;
}
本文来自博客园,作者:竹等寒,转载请注明原文链接。