跳到正文

休闲·娱乐

DC起义(未完成)

WJX114514约 24 分钟
原文
文章信息与版本

文章信息

收录
2025年12月12日
更新
2026年4月29日
篇幅
约 24 分钟
获赞
2

版本

  1. v1当前

最后更新时间2024年11月5日

身为高端的无产阶级革命家,在此等被资本主义奴隶的学校,我要反抗(bushi)

C++
//student等单词中带en的单词都是分两段输出的
#include<bits/stdc++.h>
#include<windows.h>
#include <fstream>
#include<conio.h>
using namespace std;
int people,eating;
int lang=1;//语言,1为中文,2为英语
int qiyijushu=0;
bool qingshi1=false,qingshi2=false,qingshi3=false;//所有寝室
bool jiaoshi1=false,jiaoshi2=false,jiaoshi3=false;//所有教学楼
bool shitang1=false,shitang2=false,shitang3=false;//所有食堂
bool caochang1=false,caochang2=false;//所有操场
void print(string s){//输出有间隔
	for(int i=0;i<s.size();i++){
		if(s[i]=='e'&&s[i+1]=='n'){//en输出换行
			cout<<endl; i=i+1;
		}
		else cout<<s[i];
		Sleep(30);
	}
}
struct e{
	int day;
	bool flag;
}edebuff;//饥饿debuff
int queeating(){//缺粮返回1就是死了,返回0继续游戏
	system("cls");
	if(lang==1){
		print("军中缺粮,你选择en");
		print("1.裁员(将人员减少至与食物相等)en");
		print("2.动员军队,省吃俭用(军队不会发生叛乱,获得debuff:饥饿(持续10天))en");
		print("3.坐视不管(有概率发生叛乱)en");
	}else{
		print("The army is short of food. Your choice.en");
		print("1.Downsizing (reducing staff to equal food)en");
		print("2.Mobilize the army and save money (army will not rebel, get debuff: hunger (lasts for 10 days))en");
		print("3.Sitting on the sidelines (probability of insurgency)en");
	}
	char a;
	while(a<'1'||a>'3') a=_getch();
	system("cls");
	if(a=='1'){
		print("减员");
		cout<<people-eating;
		print("人");
		people=eating;
	}else if(a==2){
		edebuff.day=10;
		edebuff.flag=true;
	}else{
		srand(1e9);
		int x=rand();
		if(x%2==1){
			print("下属发动叛乱,你死了");
			return 1;
		}else{
			print("军队在学校地下发现了大量粮食,食物+");
			cout<<2*people;
			eating+=2*people;
		}
	}
	return 0;
}
void finght_teacher2(){
	system("cls");
	print("你遇到了一队教师军团想要抢占你的领地,你选择:en");
	print("1.进攻en2.静观其变en");
	char a;
	while(a<'1'||a>'2') a=_getch();
	if(a=='1'){
		system("cls");
		if(people<=200) {
			print("阻止失败,人员-50,食物-200(原因:人员不够)en");
			if(qingshi1==true){
				qingshi1=false;
				print("寝室丢失部分en");
			}else if(shitang1==true){
				shitang1=false;
				print("食堂丢失部分en");
			}else{
				caochang1=false;
				print("操场丢失部分en");
			}
		}else{
			print("阻止成功,人员-100,食物-100");
			people-=100;
			eating-=100;
		}
	}
	if(a==2){
		system("cls");
		if(qingshi1==true){
			qingshi1=false;
			print("寝室丢失部分en");
		}else if(shitang1==true){
			shitang1=false;
			print("食堂丢失部分en");
		}else{
			caochang1=false;
			print("操场丢失部分en");
		}
	}
}
void winteacher(){
	system("cls");
	if(lang==1) print("过了一天食物-");
	else if(lang==2)print("After a day of food -");
	cout<<people<<endl;
	eating-=people;
	Sleep(1000);
	system("cls");
	if(eating<=0){
		if(lang==1) print("军中无粮,你死了");
		else if(lang==2) print("There's no food in the army. You're dead.");
		return;
	}else{
		if(lang==1) print("你选择进攻en1.教学楼en2.所有寝室en3.所有操场en");
		else if(lang==2) print("You choose offense en1. Academic buildings en2.all dormitories en3.All playgrounds en");
		char a;
		while(a<'1'||a>'3') a=_getch();
		system("cls");
		if(a=='1'){
			if(lang==1) print("楼中有大量教师,你死了");
			else if(lang==2) print("There are tons of teachers in the building. You're dead.");
			return;
		}else if(a=='2'){
			if(lang==1) print("占领成功,人员+400,食物+700");
			else if(lang==2) print("Occupation successful, personnel +400, food +700");
			people+=400; eating+=700; qingshi2=true; qingshi3=true;
		}else{
			if(lang==1) print("占领成功,人员+500,食物+300");
			else if(lang==2) print("Occupation successful, personnel +500, food +300");
			people+=500; eating+=300; caochang2=true;
		}
		Sleep(1000);
		if(people>eating){
			int x=queeating();
			if(x==1) return;
		}
		finght_teacher2();
	}
}
void fight_teacher(){
	Sleep(1000);
	system("cls");
	if(lang==1) print("你遇到了镇压起义的教师军团,你选择en1.进攻en2.撤退en");
	else if(lang==2){
		print("You e");
		print("ncounter a legion of teachers suppressing an uprising and you choose en1. to attack en2. to retreat en");
	}
	char a;
	while(a<'1'||a>'2') a=_getch();
	system("cls");
	if(a=='2'){
		if(lang==1) print("教师军团穷追不舍,队友全部战死,你死了");
		else if(lang==2) print("The Teacher's Army is in hot pursuit. All your teammates are dead. You're dead.");
		return;
	}
	else{
		if(people>=101&&eating>people){
			if(lang==1) print("你打败了教师军团,兵力-100,食物-");
			else if(lang==2) print("You defeated the legion of teachers,military strength -100,foods -");
			cout<<people<<endl;
			eating-=people;
			people-=100;
			Sleep(1000);
			winteacher();
		}
		else if(people<=100){
			if(lang==1) print("队友全部战斗到最后一刻,全军覆没,你死了");
			else if(lang==2) print("All of your teammates fought to the last minute, all of them were wiped out, and you're dead.");
			return;
		}
		else if(eating<=people){
			if(lang==1) print("军中无粮,全军饿死了,你死了");
			else if(lang==2) print("There's no food in the army. The whole army is starving. You're dead.");
			return;
		}
	}
}
void qiyi(){
	if(lang==1) print("请选择你的起义地点en1.寝室en2.食堂en3.教学楼en4.操场en");
	else if(lang==2) print("Please choose the location of your insurrection en1.dormitories en2.cafeteria en3.teaching block en4.sports field en");
	char a;
	while(a<'1'||a>'4') a=_getch();
	system("cls");
	if(a=='1'){
		if(lang==1) print("起义成功,你占领了寝室en兵力+200,食物+350en");
		else if(lang==2){
			print("The revolt is successful, you've captured the dormitory entroop stre");
			print("ngth +200, food +350 en");
		}
		people+=200; eating+=350; qingshi1=true; fight_teacher();
	}else if(a=='2'){
		if(lang==1) print("起义成功,你占领了食堂en兵力+150,食物+500en");
		else if(lang==2){
			print("The revolt is successful, you have captured the cafeteria entroop stre");
			print("ngth +150, food +500 en");
		}
		people+=150; eating+=500; shitang1=true; fight_teacher();
	}else if(a=='3'){
		if(lang==1) print("起义被老师迅速镇压,你死了");
		else if(lang==2) print("The uprising was quickly suppressed by your teacher. You're dead.");
		return;
	}else{
		if(lang==1) print("起义成功,你占领了操场en兵力+500,食物+200en");
		else if(lang==2) print("The revolt is successful, you've captured the playground entroops +500,food +200.");
		people+=500; eating+=200; caochang1=true; fight_teacher();
	}
}
void start(){//游戏开始
	people=0;
	eating=0;
	qiyijushu++;
	system("cls");
	if(lang==1){
		print("你是DC学校的一名学生,天天被学校压迫");
		print("你想起义en1.起义en2.隐忍en");
	}else if(lang==2){
		print("You're a stude");
		print("nt at a DC school and you're oppressed by the school every day ");
		print("You want to revolt en1.revolt en2.e");
		print("ndure sile");
		print("ntly en");
	}
	char a;
	while(a<'1'||a>'2') a=_getch();
	system("cls");
	if(a=='2'){
		if(lang==1) print("你天天废寝忘食的学习,积劳成疾,你死了");
		else if(lang==2) print("You've been studying all day long ,you're died");
		return;
	}else{
		qiyi();
	}
}
void gamejieshao(){//游戏简介
	system("cls");
	if(lang==1) print("在游戏中,你将扮演一位被学校压迫的学生,发动起义,并最终占领学校en按下0返回en");
	else if(lang==2) {
		print("In the game,you will play the role of a stude");
		print("nt oppressed by the school,Initiate an uprising,Finally occupying the school.enPress down 0 return en");//分行因为en是换行,student有en
	}
	char a;
	while(a!='0') a=_getch();
	return;
}
void zuozhe(){//作者简介
	system("cls");
	if(lang==1)	print("作者洛谷名:WJX114514en作者QQ号:76058206en按下0返回en");
	else print("Author luogu name:WJX114514enAuthor QQ number:76058206enPress down 0 return en");
	char a;
	while(a!='0') a=_getch();
	return;
}
void lan(){//选择语言
	system("cls");
	print("1.中文en");
	print("2.English en");
	if(lang==1) print("按下0返回 en");
	else if(lang==2) print("Press down 0 return en");
	char a;
	while(a<'0'||a>'2') a=_getch();
	if(a=='1') lang=1;
	else if(a=='2') lang=2;
	return;
}
void chengjiu(){//成就
	system("cls");
	if(lang==1){
		cout<<"--------------------------------------------------------------------------------"<<endl;
		cout<<"|名称:起义新手          |  名称:起义高手         |  名称:起义大神           |"<<endl;
		if(qiyijushu>=100){
			cout<<"|要求:起义10/10局       |  要求:起义50/50局       |  要求:起义100/100局      |"<<endl;
			cout<<"|状态:已达成            |  状态:已达成           |  状态:已达成             |"<<endl;
		}else if(qiyijushu>=50){
			cout<<"|要求:起义10/10局       |  要求:起义50/50局       |  要求:起义"<<qiyijushu<<"/100局       |"<<endl;
			cout<<"|状态:已达成            |  状态:已达成           |  状态:未达成             |"<<endl;
		}else if(qiyijushu>=10){
			cout<<"|要求:起义10/10局       |  要求:起义"<<qiyijushu<<"/50局       |  要求:起义"<<qiyijushu<<"/100局       |"<<endl;
			cout<<"|状态:已达成            |  状态:未达成           |  状态:未达成             |"<<endl;
		}else{
			cout<<"|要求:起义"<<qiyijushu<<"/10局        |  要求:起义"<<qiyijushu<<"/50局        |  要求:起义"<<qiyijushu<<"/100局        |"<<endl;
			cout<<"|状态:未达成            |  状态:未达成           |  状态:未达成             |"<<endl;
		}
		cout<<"--------------------------------------------------------------------------------"<<endl;
		}else{
		cout<<"----------------------------------------------------------------------------------------------------------"<<endl;
		cout<<"| Name: Uprising Novice          | Name: Uprising Master           | Name: Uprising Great God            |"<<endl;
		if(qiyijushu>=100){
		cout<<"| request:Uprising 10/10 innings | request:Uprising 50/50 innings  | request:Uprising 100/100 innings |"<<endl;
		cout<<"| state:Achieved                 | state:Achieved                  | state:Achieved                    |"<<endl;
		}else if(qiyijushu>=50){
		cout<<"| request:Uprising 10/10 innings | request:Uprising 50/50 innings  | request:Uprising "<<qiyijushu<<"/100 innings    |"<<endl;
		cout<<"| state:Achieved                 | state:Achieved                  | state:Not achieved                  |"<<endl;
		}else if(qiyijushu>=10){
		cout<<"| request:Uprising 10/10 innings | request:Uprising "<<qiyijushu<<"/50 innings  |  request:Uprising "<<qiyijushu<<"/100 innings    |"<<endl;
		cout<<"| state:Achieved                 | state:Not achieved              |  state:Not achieved                 |"<<endl;
		}else{
		cout<<"| request:Uprising "<<qiyijushu<<"/10 innings  |  request:Uprising "<<qiyijushu<<"/50 innings  |  request:Uprising "<<qiyijushu<<"/100 innings     |"<<endl;
		cout<<"| state:Not achieved             |  state:Not achieved             |  state:Not achieved                 |"<<endl;
		}
		cout<<"----------------------------------------------------------------------------------------------------------"<<endl;
	}
	if(lang==1) print("按下0返回en");
	else if(lang==2) print("Press down 0 return en");
	Sleep(1000);
	char a;
	while(a!='0') a=_getch();
	return;
}
void jiazai(){//加载存档
	system("cls");
	int qiyij,la;
	ifstream infile("qiyi.txt");
	if(!infile.is_open()){
		return;
	}
	infile>>qiyij>>la;
	qiyijushu=qiyij; lang=la;
	infile.close();
	Sleep(1000);
}
void jiazai2(){
	int qiyij,la;
	ifstream infile("qiyi.txt");
	if(!infile.is_open()){
		return;
	}
	infile>>qiyij>>la;
	qiyijushu=qiyij; lang=la;
	infile.close();
}
void baocun(){
	system("cls");
	ofstream infile("qiyi.txt");
	if(!infile.is_open()){
		return;
	}
	infile<<qiyijushu<<" "<<lang;
	Sleep(1000);
}
void baocun2(){
	system("cls");
	ofstream infile("qiyi.txt");
	if(!infile.is_open()){
		return;
	}
	infile<<qiyijushu<<" "<<lang;
	infile.close();
}
void zhujiemian(){//开始菜单
	system("cls");
	if(lang==1){
		print("游戏:DC起义en");
		print("1.开始游戏en");
		print("2.游戏介绍en");
		print("3.作者介绍en");
		print("4.语言选择en");
		print("5.成就en");
		print("6.载入存档en");
		print("7.保存存档en");
		print("8.退出游戏en");
	}else if(lang==2){
		print("game:DC uprising en");
		print("1.Start en");
		print("2.Game Introduction en");
		print("3.Author Introduction en");
		print("4.language en");
		print("5.accomplishme");
		print("nts en");
		print("6.Load archive en");
		print("7.save an archive en");
		print("8.Exit en");
	}
	char a='a';
	while(a<'1'||a>'8') a=_getch();
	if(a=='1'){
		start();
		Sleep(1000);
		system("cls");
		baocun2();
		char b;
		zhujiemian();
	}else if(a=='2'){
		gamejieshao();
	}else if(a=='3'){
		zuozhe();
	}
	else if(a=='4'){
		lan();
	}else if(a=='5'){
		chengjiu();
	}else if(a=='6'){
		jiazai();
	}else if(a=='7'){
		baocun();
	}else{
		return;
	}
	zhujiemian();
}
int main(){
	jiazai2();
	zhujiemian();
	return 0;
}
//https://blog.csdn.net/m0_72572822/article/details/126561153
原文