代码拿走
#include<bits/stdc++.h>
#include<windows.h>
using namespace std;
void color(int col){
if(col == 1){
cout << "\033[31m";
}else if(col == 2){
cout << "\033[1;31m";
}else if(col == 3){
cout << "\033[34m";
}else if(col == 4){
cout << "\033[36m";
}else if(col == 5){
cout << "\033[32m";
}else if(col == 6){
cout << "\033[1;32m";
}else if(col == 7){
cout << "\033[37m";
}else if(col == 8){
cout << "\033[1;37m";
}
}
int main(){
system("color");
system("title 休闲的小游戏");
cout << "Please choose your color" << endl;
cout << "1.Dark red 2.red" << endl;
cout << "3.Dark blue 4.blue" << endl;
cout << "5.Dark green 6.green" << endl;
cout << "7.Dark white 8.white" << endl;
int col;
cin >> col;
color(col);
char a = '*';
char b = '@';
char c = '#';
short num = 1;
int temp = 1;
while(true){
if(num == 30000){
system("cls");
cout << "You win!";
return 0;
}else if(getchar() == 'e' || getchar() == 'E'){
system("cls");
cout << "You lost!";
return 0;
}else{
system("cls");
for(int i = 1;i <= num;i++){
if(i >= 1000 && i % 1000 == 0){
cout << c << " ";
}else if(i >= 100 && i % 100 == 0){
cout << b << " ";
}else{
cout << a << " ";
}
temp++;
if(temp == 20){
cout << endl;
temp = 1;
}
}
num++;
temp = 1;
cout << endl << "Divided into " << num << " cells" << endl;
}
}
}
tips
选择颜色,按空格即可,E退出