编了个游戏......(第二次发了)

灌水区

tomyyf @ 2024-11-29 19:36:54

本蒟蒻编了个游戏,其中一个彩蛋还没思路,还请各位大佬多多指教

#include <cstdlib>
#include<time.h>
#include<bits/stdc++.h>
#include<windows.h>
#include<stdio.h>
using namespace std;
void egg(){

}
int main(){
    string a,b;
    char c;
    bool gun[6];
    int isgun;
    srand(time(0));
    cout<<"A,What is your name?"<<endl;
    cin>>a;
    cout<<"B,What about you?"<<endl;
    cin>>b;
    if(a==b){
        a=a+'1';
        b=b+'2';
        cout<<"Your names are same.So,A's name is "<<a<<",b's name is "<<b<<endl; 
    }
    isgun=rand()%6+1;
    for(int i=0;i<6;i++){
        if(i==isgun-1) gun[i]=1;
        else gun[i]=0;
    }
    int n=0;
    for(int i=1;i<=3;i++){
        int flag=0,cnt=0;
        cout<<"Now shoot you,"<<a<<".There are "<<i*2-1<<" bullet."<<endl;
        while(flag==0){
            cout<<"Are you ready? T or F"<<endl;
            cnt++;
            if(cnt==10) egg();
            cin>>c;
            if(c=='T' )flag++;
        }
        system("cls");
        if(gun[n]==1){
            Sleep(1000);
            cout<<a<<",YOU DIE!"<<endl;
            break;
        }
        n++;
        flag=0;
        cout<<"Now shoot you,"<<b<<".There are "<<i*2<<" bullet."<<endl;
        while(flag==0){
            cout<<"Are you ready? T or F"<<endl;
            cin>>c;
            if(c=='T' )flag++;
        }
        system("cls");
        if(gun[n]==1){
            Sleep(1000);
            cout<<b<<",YOU DIE!"<<endl;
            break;
        }
        n++;
    }
    cout<<"Process exited after 13.37 seconds with return value 0"<<endl;
    system("pause");
    Sleep(10000);
    system("cls");
    cout<<"A:他们走了吗?"<<endl;
    Sleep(3000);
    cout<<"B:应该吧......"<<endl;
    Sleep(2000);
    cout<<"A:刚刚真是一场精彩的赌博!"<<endl;
    Sleep(2000);
    cout<<"C:Yes,it is amazing!"<<endl;
    Sleep(1000);
    cout<<"C:Wait,what are the name of them?"<<endl;
    Sleep(3000);
    cout<<"A:"<<a<<" and "<<b<<endl;
    Sleep(2000);
    cout<<"B:怎么有一点熟悉......"<<endl;
    Sleep(4000);
    system("cls");
    cout<<"B:是那两个条子(警察)!"<<endl;
    Sleep(2000);
    cout<<"A:愣什么?快跑啊!"<<endl;
    Sleep(2000);
    cout<<"......"<<endl;
    Sleep(3000);
    system("cls");
    cout<<"B:来不及了......(拿起左轮)"<<endl;
    Sleep(3000);
    cout<<"B:记住,下次来要一直说没准备好......"<<endl;
    Sleep(1000);
    system("cls");
    cout<<"沉默"<<endl;
    Sleep(2000);
    system("cls");
    cout<<"砰!"<<endl;
    Sleep(3000);
    return 0;
}

by hg20230121 @ 2024-11-29 19:41:06

zc


by hg20230121 @ 2024-11-29 19:42:47

@tomyyf 建议加个说明


by tomyyf @ 2024-11-29 19:46:38

@hg20230121感谢


by huanghaichuan @ 2024-11-29 20:22:43

6,建议加说明


by fangkai123 @ 2024-11-29 20:23:29

建议该成中文更好理解


|