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;
}

posted @ 2022-03-12 23:49  竹等寒  阅读(19)  评论(0编辑  收藏  举报  来源