又是无聊的一天

· · 个人记录

又是无聊的一天

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

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