专栏文章

神秘

个人记录参与者 1已保存评论 0

文章操作

快速查看文章及其快照的属性,并进行相关操作。

当前评论
0 条
当前快照
1 份
快照标识符
@mipekg0c
此快照首次捕获于
2025/12/03 10:43
3 个月前
此快照最后确认于
2025/12/03 10:43
3 个月前
查看原文
CPP
#include<iostream>
#include<ctime>
#include<cstring>
#include<unistd.h>
#include<cmath>
using namespace std;
int s;
bool fdfzapp=false;
int app, money=0;
void Slow(string s){
	for(int i=0; i<s.size(); i++){
		cout << s[i];
		_sleep(10);
	}
	cout << "\n";
}
void cpdd(){
	Slow("Welcome to Lijiasheng and Xiangtiange's Home.");
	_sleep(1000);
	Slow("They are doing something we can't see!");
	_sleep(1000);
	Slow("Oh, we must be leave now.");
	_sleep(1000);
	Slow("Oh, Lijiasheng see us.");
	_sleep(500);
	int _1536=rand()%2;
	if(_1536)Slow("He is happy so he give us some money."),money+=rand()%1000+1;
	else Slow("He is angry so he take some money."),money-=rand()%1000+1;
}
void xiazai(int application){
	if(fdfzapp == false){
		std::srand(std::time(0));
    	int rand_num = std::rand() % 10000 + 1;
		money -= rand_num;
		Slow("You were deceived!");
		cout << "\n";
	} else {
		Slow("You are lucky!");
		cout<< "\n";
		std::srand(std::time(0));
    	int rand_num = std::rand() % 100 + 1;
		money+=rand_num;
	}
}
void guacaipiao(){
	Slow("Buying a lottery ticket costs 10 dollars.");
	int a;
	std::srand(std::time(0));
    int rand_num = std::rand() % 100 + 1;
    Slow("Please enter number among 1 to 100.");
    cin >> a;
    if(a == rand_num){
    	Slow("Wow! You won the prize! money + 20000.");
    	money += 20000;
    	return ;
	} else if(abs(a - rand_num)<=5){
		Slow("Wow! You won the prize! money + 10000.");
		money += 10000;
    	return ;
	} else if(abs(a - rand_num)<=10){
		Slow("Wow! You won the prize! money + 5000.");
		money += 5000;
    	return ;
	} else {
		Slow("Oh! You won't the prize!");
		return ;
	}
}
int main () {
	int num = 0, as = 0;
	bool f = false;
	Slow("Enter one number to begin the game.");
	while(1){
		if(money >= 100000){
			Slow("Win!");
			Slow("Game Over!");
			break;
			as = 0;
		}
		fdfzapp = false;
		//cout << "money : " << money << "$\n";
		string str = "money : ";
		for(int i=0; i<str.size(); i++){
			cout << str[i];
			_sleep(10);
		}
		cout << money;
		cout << "$\n";
		cin >> s;
		if(s == 1536 || s == 3615){
			cpdd();
			continue;
		}
		if(s == 4330){
			Slow("You triggered the Easter egg!");
			Slow("You Win!");
			Slow("Game Over!");
			return 0;
		}
		if(s == 1) {
			xiazai(app);
			continue;
		} else if(s == 2) {
			as++;
			if(as >= 10){
				Slow("You always lucky,I'm angry!");
				std::srand(std::time(0));
    			int rand_num = std::rand() % 10000 + 1;
				money -= rand_num;
				as = 0;
			} else {
				fdfzapp=true;
				xiazai(app);
			}
			continue;
		} else if(s == 3){
			guacaipiao();
		}else if(s != 2 && s != 1 && s != 3) {
			Slow("Welcome to the'Gessing Number Game'!");
			Slow("Please guess the answer correctly within 5 times!(zero to one hundred)");
 		    std::srand(std::time(0));
    		int rand_num = std::rand() % 100 + 1;
			for(int i=0; i<5; i++){
				int a;
				cin >> a;
				if(a == rand_num && num <= 5){
					Slow("Win! money + 10000!");
					money += 10000;
					f = true;
					cout << f;
					break;
				} else if(a < rand_num-10){
					num++;
					Slow("Too small!");
				} else if(a > rand_num+10){
					num++;
					Slow("Too big!");
				} else if(a < rand_num && a >= rand_num-10){
					num++;
					Slow("Almost, bigger please!");
				} else if(a > rand_num && a <= rand_num+10){
					num++;
					Slow("Almost, smaller please!");
				}
			}
			if(!f){
				Slow("Defeat!");
				cout << rand_num;
				Slow(" is right!");
				Slow("money - 2000!");
				money -= 2000;
				as = 0;
			}
		}
	}
	return 0;
}

评论

0 条评论,欢迎与作者交流。

正在加载评论...