C++小游戏:你 猜 我 想(原创)

        自编小游戏,欢迎私信或评论,提供建议、bug和不足之处。

游戏名解释:你(玩家)、我(电脑)。

后期更新:你想我猜1.1、你猜我猜1.2、二人转1.3。

代码:

#include<bits/stdc++.h>
using namespace std;
int main(){
		system("color E1");
	int a,c,d=0;
	string b;
	srand(time(0));
	c=rand()%100+1;
	while(1){
	cout<<"	 	======================================================================="<<endl;
	cout<<"	 	||                                                                   ||"<<endl;
	cout<<"	 	||                                                                   ||"<<endl;
	cout<<"	 	||                           你 猜 我 想                             ||"<<endl;
	cout<<"	 	||                                                                   ||"<<endl;
	cout<<"	 	||                                                                   ||"<<endl;
	cout<<"	 	======================================================================="<<endl;
	
	cout<<"======================================================================================================"<<endl; 
	
	cout<<setw(90)<<right<<"分数:"<<d<<endl;
	cout<<"请输入一个数字:";
	cin>>a;
	
	b=(a==c)?"猜对了!":"猜错了";
	cout<<b<<endl;
	if(b=="猜对了!"&&a==c){
		d++;
		srand(time(0));
		c=rand()%100+1;
	} 
	if(b=="猜错了"&&a>c){
			cout<<"大了"<<endl;
	}
	if(b=="猜错了"&&a<c){
		
			cout<<"小了"<<endl;
	}
	system("Pause");
	 system("cls");
}
	return 0;
}

时间是治疗心灵创伤的大师,但绝不是解决问题的高手。  6gn.

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值