跳到正文

个人记录

又是无聊的一天

qi_jiu_awa约 1 分钟
原文
文章信息与版本

文章信息

收录
2026年5月15日
更新
2026年5月15日
篇幅
约 1 分钟

版本

  1. v2当前
  2. v1

又是无聊的一天

和上次一样,无聊的我写了一段有这样效果的一段代码

C++
#include <bits/stdc++.h>
#include <windows.h>
using namespace std;

void Setcolor(int forgclr,int backclr){
	WORD wcolor=((backclr&0x0F)<<4)+(forgclr&0x0f);
	SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),wcolor);
}

int Rando(int frist,int last){
	return rand()%(last-frist)+frist;
}
int main(){
	srand(time(0));
	while (1){
		for (int i=1;i<=1800;i++){
			int tmp=Rando(0,15);
			Setcolor(tmp,tmp);
			putchar('■');
			putchar('■');
		}
	}
	return 0;
}
原文