休闲的c++游戏

代码拿走

#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退出

  • 8
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值