c++實現彩色炫酷(?)畫面

跳到水面呼吸發表於2020-10-25

嘿嘿,太水了,程式碼上

#include <iostream>
#include <windows.h>
#include <stdlib.h>
#include <time.h>
using namespace std;
void color(unsigned int ForeColor=7,unsigned int BackGroundColor=0) 
{
    HANDLE handle=GetStdHandle(STD_OUTPUT_HANDLE);  
    SetConsoleTextAttribute(handle,ForeColor+BackGroundColor*0x10);
}
int main(){
	srand(time(NULL));
	while(1){
		int t=rand()%8,k=rand()%8;
		color(t,k);
		cout<<"                ";
	}
	return 0;
}

哈哈

相關文章