#include <bits/stdc++.h>
#include <unistd.h>
using namespace std;
int kaishi,n,a = 100,b = 100;
int main(){
cout << "------------------" << endl;
cout << "| 开始游戏 |" << endl;
cout << "| 1.开始 2.退出 |" << endl;
cout << "------------------" << endl;
cin >> kaishi;
if(kaishi == 2){
cout << "退出成功";
return 0;
}
cout << "游戏忠告:" << endl;
cout << "抵制不良游戏,拒绝盗版游戏。注意自我保护,谨防受骗上当。" << endl;
cout << "适度游戏益脑,沉迷游戏伤身。合理安排时间,享受健康生活。" << endl;
cout << "----------------------------" << endl;
cout << "| 请选择你的游戏角色 |" << endl;
cout << "| 1.步兵 2.空军 3.坦克兵 |" << endl;
cout << "----------------------------" << endl;
cin >> n;
if(n == 1){
cout << "-----------------------------------------------" << endl;
cout << "| 请选择你武器 |" << endl;
cout << "| 1.m4a1卡宾枪 2.ak47突击步枪 3.m134转管机枪 |" << endl;
cout << "-----------------------------------------------" << endl;
int x;
cin >> x;
if(x == 1){
cout << "在2012年5月27号你来到了阿富汗,参加了阿富汗战争" << endl;
cout << "你的血量为100,敌方的血量为100" << endl;
while(true){
if(rand() % 2 == 0){
a -= 10;
cout << "你被敌方攻击了" << endl << "你的血量为" << " " << a << endl;
sleep(1);
}else{
b -= 10;
cout << "敌方被你攻击了" << endl << "敌方的血量为" << " " << b << endl;
sleep(1);
}
if(a == 0){
cout << "很遗憾,你*了" << endl << "游戏结束";
return 0;
}if(b == 0){
cout << "恭喜你,你消灭了敌人" << endl << "游戏结束";
return 0;
}
}