跳到正文

休闲·娱乐

洛谷精灵(1.0版本)

jiangyunuo约 2 分钟
原文
文章信息与版本

文章信息

收录
2026年5月4日
更新
2026年5月5日
篇幅
约 2 分钟

版本

  1. v2当前
  2. v1
C++
#include<bits/stdc++.h>
using namespace std;
int main(){
    string a[]={"kkksc03","洛谷","chen_zhe"};
    luaul:
    cout<<"你来到了一个充满洛谷精灵的地方,你有以下精灵可以选择:" <<endl;
    cout<<"0."<<a[0]<<" "<<"1."<<a[1]<<" "<<"2."<<a[2]<<endl;
    int x;
    cin>>x;
    if(x!=1&&x!=0&&x!=2){cout<<"输入错误"<<endl;goto luaul;}
    else cout<<"你获得了一只"<<a[x]<<endl;
    char b1,b2;
	while(1){
	    laual:
		cout<<"你想干什么?"<<endl;
		cout<<"A.打怪   B.不玩了"<<endl;
		cin>>b1;
		if(b1==65){
			lgagl:
			cout<<"你想怎么做?"<<endl;
			cout<<"A.让"<<a[x]<<"攻击   B.带着"<<a[x]<<"逃跑"<<endl;
			cin>>b2;
			if(b2==65)cout<<a[x]<<"干掉了怪物"<<endl;
			else if(b2==66)cout<<"你们逃走了"<<endl;
			else{
			    cout<<"输入错误"<<endl;
			    goto lgagl;
			}
		}
		else if(b1==66){
			cout<<"好的,再见"<<endl;
			return 0;
		}
		else{
		    cout<<"输入错误"<<endl;
		    goto laual;
		}
	}
    return 0;
}
原文