跳到正文

个人记录

新做的小游戏,大家试试看!!

用户 1544740约 1 分钟
原文
文章信息与版本

文章信息

收录
2025年12月12日
更新
2025年12月12日
篇幅
约 1 分钟

版本

  1. v1当前
C++
#include<bits/stdc++.h>
using namespace std;
int main(){
	int a=100;
	int b=100;
	while(a>=0&&b>=0){
	int end=-1;
	srand(time(0));
	end=rand()%2;
		int d=0;
		cout<<"HOW MONEY ?"<<endl;
		cin>>d;
		int c=0;
		cout<<"WHAT DO YOU C ?"<<endl;
		cin>>c;
		if(c==end){
		a=a+d;
		b=b-d;}
		cout<<"YOU WIN !"<<endl;
		cout<<a<<" "<<b<<endl;
		if(c!=end){
		a=a-d;
		b=b+d;
		cout<<"YOU LOST !"<<endl;
		cout<<a<<" "<<b<<endl;}
	}
	if(a<0){
	cout<<"YOU DIE !";
	return 0;}
	else if(b<0){
	cout<<"YOU WIN !";
	return 0;}
	return 0;
}
原文