跳到正文

个人记录

流浪汉模拟器

Junyi_Jiang约 88 分钟
原文
文章信息与版本

文章信息

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

版本

  1. v2当前
  2. v1
C++
#include<cmath> //jiangjunyi2023编写
#include<time.h>//23/06/17   更新疾病系统
#include<cstdio>//23/07/10   统一标点,优化提示
#include<iostream>
#include<cstring>
#include<windows.h>
#include<conio.h>
#include<string>
#include<cstdlib>
#include<bits/stdc++.h>
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<stdio.h>
#include<string>
#include<cstring>
#include<istream>
#include<ostream>
#include<map>
#include<vector>
#include<queue>
#include<cmath>
#include<windows.h>
#include<algorithm>
#include<time.h>
#include<ctime>
#include<stdlib.h>
#include<cstdlib>
#include<stddef.h>
#include<stdint.h>
#include<stdbool.h>
#include<math.h>
#define getchar()   _getch()
using namespace std;
int where=0,x=11,y=1;
bool run(int n){
    if(n%100==0&&n%400==0||n%4==0)return true;
    return false;
}
struct Player{
    string names;
    int old=30;
    int HP=100,maxHP=100,money=100,stin=0,maxstin=100;
    float sleep=8;
    int hr=7,min=0;
    int year=2023,month=3,day=1;
    int paper=10,shift=0,afood=0,guan=0;//废品交互道具
    float tiwen=36.5;
    int xiang=0;
    //----------------------------------------------------以下是衣服
    string clonames[4][4]={{"无","草帽","鸭舌帽","军大衣の帽"},
                           {"无","白背心","短袖","军大衣"},
                           {"无","绿短裤","牛仔裤","棉裤"},
                           {"无","拖鞋","运动鞋","足力健"}};
    string bodyname[4]={"帽子","衣服","腿裤子","鞋子"};
    int body[4]={0},Hasclothes[4][4]={{0},{0},{0},{0}};
    int clothesmoney[4][4]={{0,100,120,150},{0,130,150,200},{0,120,150,250},{0,50,80,100}};
    int clothesmath[4][4]={{0,-2,-3,2},{0,-5-3,5},{0,-3,1,3},{0,-2,1,2}};
    int hot=0;
    float s_for_wen[4] ={0,0.12,0,-0.12};
    //-----------------------------------------------------以下是疾病
    bool ill[3]={false};
    bool sill[3]={false};
    int yaomoney[4]={50,50,25,40},Hasyao[4]={0};
    string yaonames[4]={"止泻药","只泻药","退烧贴","退烧药"};
    string illnames[3]={"中暑","发烧","腹泻"};
    //-----------------------------------------------------以下是排泄
    int goshift=0,maxshift=100;
    int food=100,drink=100,maxfood=100,maxdrink=100;
    int zhi=0,zhiest=0,shi=0;
    //==========================================================
}play;
int suiji(int a,int b)
{
	srand(time(0));
	return (rand () % (b-a+1))+ a;
}
struct people{
	int likes,old;
	string feel[4]={"高兴","伤心","厌恶","愤怒"},names,feeling;
	string xing={"赵钱孙李周吴郑王冯陈楮卫蒋沈韩杨朱秦尤许何吕施张孔曹严华金魏陶姜戚谢邹喻柏水窦章云苏潘葛奚范彭郎鲁韦昌马苗凤花方俞任袁柳酆鲍史唐费廉岑薛雷贺倪汤滕殷罗毕郝邬安常乐于时傅皮卞齐康伍余元卜顾孟平黄和穆萧尹姚邵湛汪祁毛禹狄米贝明臧计伏成戴谈宋茅庞熊纪舒屈项祝董梁杜阮蓝闽席季麻强贾路娄危江童颜郭梅盛林刁锺徐丘骆高夏蔡田樊胡凌霍虞万支柯昝管卢莫经房裘缪干解应宗丁宣贲邓郁单杭洪包诸左石崔吉钮龚程嵇邢滑裴陆荣翁荀羊於惠甄麹家封芮羿储靳汲邴糜松井段富巫乌焦巴弓牧隗山谷车侯宓蓬全郗班仰秋仲伊宫宁仇栾暴甘斜厉戎祖武符刘景詹束龙叶幸司韶郜黎蓟薄印宿白怀蒲邰从鄂索咸籍赖卓蔺屠蒙池乔阴郁胥能苍双闻莘党翟谭贡劳逄姬申扶堵冉宰郦雍郤璩桑桂濮牛寿通边扈燕冀郏浦尚农温别庄晏柴瞿阎充慕连茹习宦艾鱼容向古易慎戈廖庾终暨居衡步都耿满弘匡国文寇广禄阙东欧殳沃利蔚越夔隆师巩厍聂晁勾敖融冷訾辛阚那简饶空曾毋沙乜养鞠须丰巢关蒯相查后荆红游竺权逑盖益桓公"};
string xinges={"万俟司马上官欧阳夏侯诸葛闻人东方赫连皇甫尉迟公羊澹台公冶宗政濮阳淳于单于太叔申屠公孙仲孙轩辕令狐锺离宇文长孙慕容鲜于闾丘司徒司空丌官司寇子车颛孙端木巫马公西漆雕乐正壤驷公良拓拔夹谷宰父谷梁段干百里东郭南门呼延羊舌微生梁丘左丘东门西门"};
}peo;
void print(string s)
{
    for(int i=0;i<=s.length();i++)
    {
        cout<<s[i];
        Sleep(100);
    }
}
void say()
{
	system("cls");
	char a;
	peo.old=suiji(20,50),peo.likes=60-play.stin;
	peo.feeling=peo.feel[suiji(1,4)];
	peo.names=peo.xing[suiji(1,407)]+peo.xinges[suiji(1,407)];
	while(a!='0')
	{


	}
}
string lbwfood[12]={"鼻屎","猪肉","鸡肉","炒蛋","鸡蛋","煲粥","米饭","炒河粉","炒米粉","炒米饭","炒水","炒b"};
void lbw()
{
    system("cls");
    print("卢本伟:从现在开始这个人叫做lbw");
    system("cls");
    for(int i=0;i<12;i++)cout<<i+1<<".番茄"<<lbwfood[i]<<endl;
    cout<<"通通20$!!!";
	int a;
	cin>>a;
	if(a<=0)return;
	if(play.money>=20){
		play.money-=20;
		cout<<"你点了一份番茄"<<lbwfood[a-1]<<",真香";
		play.food+=50;
		getchar();
		system("cls");
	}
	else printf("你没钱");getchar();system("cls");
}
void dotrash(int n){
	system("cls");
	string trash[3][6]={{{" 1 2 3 4 5"},
					 {"1? ? ? ? ?"},
					 {"2? ? ? ? ?"},
					 {"3? ? ? ? ?"},
					 {"4? ? ? ? ?"},
					 {"5? ? ? ? ?"}},
					 //------------------------
					 {{"1 2 3 4 5 6 7 8"},
					 {"1? ? ? ? ? ? ? ?"},
					 {"2? ? ? ? ? ? ? ?"},
					 {"3? ? ? ? ? ? ? ?"},
					 {"4? ? ? ? ? ? ? ?"},
					 {"5? ? ? ? ? ? ? ?"}},
					 //========================
					{{" 1 2 3 4 5 6 7 8 9"},
					 {"1? ? ? ? ? ? ? ? ?"},
					 {"2? ? ? ? ? ? ? ? ?"},
					 {"3? ? ? ? ? ? ? ? ?"},
					 {"4? ? ? ? ? ? ? ? ?"},
					 {"5? ? ? ? ? ? ? ? ?"}}};
	bool tra[3][6][10]={false};
	for(;;){
		system("cls");
		printf("P报纸  G易拉罐     S答辩   \nA餐厨垃圾    Z纸皮   X香水             任意大写字母退出\n_____________________________________________________________________________\n");
		for(int i=0;i<6;i++)cout<<trash[n][i]<<endl;
		cout<<"探索/拿走第几行?"<<endl;
		int a=_getch()-'0';
		cout<<endl<<"第几列?"<<endl;
		int b=_getch()-'0';

		if(a>9||b>9)break;
		if(!tra[n][a][b]){
			srand(time(0));
			switch(rand()%7){
				case 1:{
					trash[n][a][b*2-1]='P';//报纸
					break;
				}
				case 2:{
					trash[n][a][b*2-1]='G';//易拉罐
					break;
				}
				case 3:{
					trash[n][a][b*2-1]='S';//答辩
					break;
				}
				case 4:{
					trash[n][a][b*2-1]='A';//餐厨垃圾
					break;
				}
				case 5:{
					trash[n][a][b*2-1]='Z';//纸皮
					break;
				}
				case 6:{
					trash[n][a][b*2-1]=' ';//空
					break;
				}
				case 7:{
					trash[n][a][b*2-1]='X';//香水
					break;
				}
			}
			tra[n][a][b]=true;
			play.min++;
		}else if(tra[n][a][b]){
			switch(trash[n][a][b*2-1])
			{
				case 'P':{
					play.paper++;
					break;
				}
				case 'G':{
					play.guan++;
					break;
				}
				case 'S':{
					play.shift++;
					break;
				}
				case 'A':{
					play.afood++;
					break;
				}
				case 'Z':{
					play.zhi++;
					break;
				}
				case ' ':{
					break;
				}
				case 'X':{
					play.xiang++;
					break;
				}
				case 'W':{
					play.drink+=10;
					break;
				}
				case 'F':{
					play.food+=10;
					break;
				}
				case 'Y':{
					break;
				}
			}
			trash[n][a][b*2-1]=' ';
			play.min++;
		}
	}
	system("cls");
}
void trash()
{

	srand(time(0));
	int a=rand()%10;
	if(a>=9)dotrash(2);
	else if(a>=6)dotrash(1);
	else dotrash(0);
}

void goshift(int n)
{
	switch(n)
	{
		case 2:{
			system("cls");
			print("哼...哼...哼...哼...啊~~~~~~~");
			cout<<endl;
			print("舒服~~~~~~");
			system("cls");
			printf("用什么擦PP\n");
			printf("1.卫生纸     %d个\n2.高级卫生纸     %d个\n3.报纸     %d斤\n4.艹 不擦了 \n",play.zhi,play.zhiest,play.paper);
			int a=_getch()-'0';
			system("cls");
			switch(a)
			{
				case 1:{
					printf("你在卫生纸上留下了棕色的签名");
					getchar();
					break;
				}
				case 2:{
					printf("噢shift!这该死的高级感");
					getchar();
					break;
				}
				case 3:{
					printf("刚捡3秒还能擦");
					getchar();
					play.stin+=5;
					break;
				}
				case 4:{
					printf("虽然不是同一个时间,但是同一个撤硕,奥利给,干了兄弟们!");
					getchar();
					play.stin+=10;
					break;
				}
			 }
			 getchar();
			 play.goshift=0;
			 system("cls");
			break;
		}
		case 3:{
			print("你赖在身上了         太TM臭了!!!");
			play.stin+=20;
			play.goshift=0;
			break;
		}
	}
 }
void shopcloth()
{
	system("cls");
	print("店员:先生...怎么是个乞丐?没钱就滚!");
	system("cls");
	printf("买\n");
	for(int i=0;i<4;i++)cout<<i+1<<'.'<<play.bodyname[i]<<endl;
	printf("*************************************************\n0.离开\n1.买帽子\n2.买衣服\n3.买裤子\n4.买鞋子\n");
	int a=_getch();
	if(a=='0')return;
	a-='1';
	system("cls");
	for(int i=1;i<4;i++)cout<<i<<'.'<<play.clonames[a][i]<<"              "<<play.clothesmoney[a][i]<<"$"<<endl;
    int b=_getch()-'0';
    system("cls");
    if(play.money>=play.clothesmoney[a][b]){
        cout<<"你买了"<<play.clonames[a][b]<<",花费"<<play.clothesmoney[a][b]<<"$";
		play.money-=play.clothesmoney[a][b];
		play.Hasclothes[a][b]++;
	}
	else printf("店员:我就说嘛,一个乞丐怎么可能有钱");
	getchar();
	system("cls");
}
void clothnew(int n)
{
	system("cls");
	cout<<"目前衣着:"<<play.bodyname[n]<<" : "<<play.clonames[n][play.body[n]]<<endl;
	cout<<"***********************************************"<<endl;
	for(int i=0;i<4;i++)cout<<i+1<<"."<<play.clonames[n][i]<<" 有 "<<play.Hasclothes[n][i]<<" 件 "<<endl;
	printf("换哪一件?");
	int a=_getch()-'0';
	if(play.Hasclothes[n][a-1]>0){
		play.Hasclothes[n][play.body[n]]++;
		play.body[n]=a-1;
		play.Hasclothes[n][play.body[n]]--;
		system("cls");
		return ;
	}
	else{
		system("cls");
		print("你没有这件衣服");
		getchar();
		system("cls");
		return;
	}
}
void clothes()
{
	huanclo:
	system("cls");
	cout<<"0.退出"<<endl;
	for(int i=0;i<4;i++)cout<<i+1<<"."<<play.bodyname[i]<<" : "<<play.clonames[i][play.body[i]]<<endl;
	cout<<"体温加成:"<<play.hot<<endl;
	cout<<"季节影响:";
	if(play.month==3||play.month==4||play.month==5)cout<<play.s_for_wen[0];
    if(play.month==6||play.month==7||play.month==8)cout<<play.s_for_wen[1];
    if(play.month==9||play.month==10||play.month==11)cout<<play.s_for_wen[2];
    if(play.month==12||play.month==1||play.month==2)cout<<play.s_for_wen[3];
    cout<<endl;
	printf("改变哪个部位穿着?");
	int a=_getch()-'0';
	if(a==0)return;
	clothnew(a-1);
	goto huanclo;
}
void hospital()
{
	system("cls");
	print("医生:进门不得携带苹果!!!");
	system("cls");
	printf("0.离开\n1.看医生(治愈所有疾病)  100$\n2.买药\n");
    int a=_getch()-'0';
    switch(a){
        case 0:break;
        case 1:{
            if(play.money>=100){
                system("cls");
            print("医生:来,让我看看");
            cout<<endl<<endl<<play.names;
            print(":不要!");
            cout<<endl;
            print("医生:听话,让我看看!");
            cout<<endl<<endl<<play.names;
            print(":哼...哼...哼...啊~~~~~~~");
            system("cls");
            printf("看完医生后,你感觉身心舒畅~~~~~");
            for(int i=0;i<3;i++)play.ill[i]=play.sill[i]=false;
			play.HP+=10;
            }
            else printf("你没有钱,你个穷光蛋");
            getchar();
            break;
        }
        case 2:{
            system("cls");
            for(int i=0;i<4;i++)cout<<i+1<<'.'<<play.yaonames[i]<<"     "<<play.yaomoney[i]<<"$"<<endl;
			a=_getch()-'0';
			if(a==0)break;
			if(play.money>=play.yaomoney[a-1]){
				system("cls");
				cout<<"你购买了"<<play.yaonames[a-1]<<",花费"<<play.yaomoney[a-1]<<"$"<<endl;
                play.money-=play.yaomoney[a-1];
            }
            else printf("你没有足够的钱");
            break;
        }
    }
    getchar();
    system("cls");
 }
 void is_ill(int n)
 {
    switch(n){
        case 1:{//判定生病
            if(play.tiwen>38.0&&!play.ill[1])play.ill[0]=true;
            srand(time(0));
            break;
         }
         case 2:{//脏乱判断生病
            if(rand()%100>=90&&!play.ill[0])play.ill[1]=play.sill[1]=true;
            srand(time(0));
            if(rand()%100>=90)play.ill[2]=play.sill[2]=true;
            break;
         }
         case 3:{//生病自愈
            srand(time(0));
            if(rand()%10000>=999&&!play.ill[0])play.ill[1]=play.sill[1]=false;
            srand(time(0));
            if(rand()%10000>=999)play.ill[2]=play.sill[2]=false;
            break;
         }
         case 4:{//生病惩罚
            if(play.ill[0])play.HP-=1;
            if(play.ill[1]){
                play.HP-=1;
                srand(time(0));
                if((rand()%100)%2+1){
                    srand(time(0));
                    play.tiwen+=rand()%3*0.1;
                 }
                 else {
                    srand(time(0));
                    play.tiwen-=rand()%3*0.1;
                 }
             }
             if(play.ill[2])play.goshift++;
            break;
         }
     }
 }
void use_y(int n)
{
	switch(n)
	{
		case 1:{//止泻药
			play.ill[2]=play.sill[2]=false;
			break;
		}
		case 2:{//只泻药
			play.ill[2]=play.sill[2]=true;
			break;
		}
		case 3:{//退烧贴
			if(suiji(1,100)>=70)play.ill[1]=play.sill[1]=false;
			break;
		}
		case 4:{
			play.ill[1]=play.sill[1]=false;
			break;
		}
	 }
}
void fieliao(){
    print("老板:收肥料");
    system("cls");
    printf("1.售卖肥料\n2.购买肥料\n3.离开");
    char a=_getch()-'0';
    system("cls");
    switch(a){
        case 1:{
            printf("1.答辩·············1$一斤\n");
			printf("2.餐厨垃圾···········5$一斤\n");
            printf("****************************************\n");
            a=_getch()-'0';
            switch(a){
                case 1:{
                    if(play.shift>0){
                        print("老板:行,卖几斤?");
                        printf("\n\n\n\n\n********************************************\n1.我不卖了     2.让我想想\n");
                        liao1:
                        cin>>a;
                        switch(a){
                            case 1:{
                                system("cls");
                                print("老板:你这小子耍我呢???");
                                break;
                            }
                            case 2:{
                                system("cls");
                                print("卖几斤呢?");
                                printf("                                   你有%d斤答辩\n",play.shift);
                                a=_getch()-'0';
                                if(a>play.shift){
                                    system("cls");
                                    print("老板:我寻思你也没有这么多答辩啊???");
                                    goto liao1;
                                }
                                else if(a<=0){
                                    system("cls");
                                    print("老板:TM的耍我呢???");
                                }
                                else if(a>0&&a<=play.shift){
                                    system("cls");
                                    print("小伙子,再见~~~~~~~~~");
                                    system("cls");
                                    print("你赚到了");
                                    Sleep(100);
                                    printf("%d",a);
                                    Sleep(100);
                                    print("$");
									play.money+=a;
									}
							break;
							}
						}
						break;
		}
		else system("cls");print("你有答辩???");getchar();system("cls");
	}
	case 2:{
		if(play.afood>0){
						print("老板:行,卖几斤?");
						printf("\n\n\n\n\n********************************************\n1.我不卖了     2.让我想想\n");
						liao2:
						a=_getch()-'0';
						switch(a){
							case 1:{
								system("cls");
								print("老板:你这小子耍我呢???");
								break;
							}
							case 2:{
								system("cls");
								print("卖几斤呢?");
								printf("                                   你有%d斤餐厨垃圾\n",play.afood);
								cin>>a;
								if(a>play.afood){
									system("cls");
									print("老板:我寻思你也没有这么多餐厨垃圾啊???");
									goto liao2;
								}
								else if(a<=0){
									system("cls");
									print("老板:TM的耍我呢???");
								}
								else if(a>0&&a<=play.afood){
									system("cls");
									print("小伙子,再见~~~~~~~~~");
									system("cls");
									print("你赚到了");
									Sleep(100);
									printf("%d",a*5);
									Sleep(100);
									print("$");
                                    play.money+=a*5;
                                    }
                            break;
                            }
                        }
                        break;
        }
        else system("cls");print("你有餐厨垃圾???");getchar();system("cls");
        break;
    }
}
}
case 3:print("老板:不卖就快点走"); getchar();
}
system("cls");
}
void feipin()
{

    system("cls");
    print("老人:高价回收\n电冰箱\n旧手机\n吹风机\n电动车\n电视机");
    system("cls");
    printf("1.出售废品\n");
    printf("2.离开\n");
    char a=_getch()-'0';
    switch(a)
    {
        case 1:{
            system("cls");
            printf("1.报纸··············5$一斤\n");
			printf("2.易拉罐·············10$一斤\n");
            printf("**********************************************");
            a=_getch()-'0';
            switch(a)
            {
                case 1:{//卖报纸
                    system("cls");
                    if(play.paper>0){
                        print("老人:行,卖几斤?");
                        printf("\n\n\n\n\n********************************************\n1.我不卖了     2.让我想想\n");
                        zhi:
                        a=_getch()-'0';
                        switch(a){
                            case 1:{
                                system("cls");
                                print("老人:你这小子耍我呢???南村群童欺我老无力啊~~~~~~");
                                break;
                            }
                            case 2:{
                                system("cls");
                                print("老人:卖几斤呢?");
                                printf("                                   你有%d斤报纸\n",play.paper);
                                int b;
                                cin>>b;
                                if(b>play.paper){
                                    system("cls");
                                    print("老人:我寻思你也没有这么多纸啊???");
                                    goto zhi;
                                }
                                else if(b<=0){
                                    system("cls");
                                    print("老人:TM的耍我呢???");
                                }
                                else if(b>0&&b<=play.paper){
                                    system("cls");
                                    print("老人:小伙子,再见~~~~~~~~~");
                                    system("cls");
                                    print("你赚到了");
                                    Sleep(100);
                                    printf("%d",b*5);
                                    Sleep(100);
                                    print("$");
									play.money+=b*5;
									play.paper-=b;
								}
								break;
							}
						}
					}
					else{//报纸不够了
						print("老人:你有报纸!?!?!?!?");
						getchar();
						break;
					}
					break;
				}//卖报纸
				case 2:{
					system("cls");
						if(play.guan>0){
							print("老人:行,卖几斤?");
							printf("\n\n\n\n\n********************************************\n1.我不卖了     2.让我想想\n");
							zhi2:
							a=_getch()-'0';
							switch(a){
							case 1:{
								system("cls");
								print("老人:你这小子耍我呢???南村群童欺我老无力啊~~~~~~");
								break;
							}
							case 2:{
								system("cls");
								print("老人:卖几斤呢?");
								printf("                                   你有%d斤易拉罐\n",play.guan);
								int b;
								cin>>b;
								if(b>play.guan){
									system("cls");
									print("老人:我寻思你也没有这么多易拉罐啊???");
									goto zhi2;
								}
								else if(b<=0){
									system("cls");
									print("老人:TM的耍我呢???");
								}
								else if(b>0&&b<=play.guan){
									system("cls");
									print("老人:小伙子,再见~~~~~~~~~");
									system("cls");
									print("你赚到了");
									Sleep(100);
									printf("%d",b*10);
									Sleep(100);
									print("$");
                                    play.money+=b*10;
                                    play.guan-=b;
                                }
                                break;
                            }
                        }

                        }else{//易拉罐不够了
                        print("老人:你有易拉罐!?!?!?!?");
                        getchar();
                        break;
                    }
                    }

                    break;
                break;
            }
            break;
        }
        case 2:print("老人:不卖你来干什么???");break;
     }
     system("cls");
 }
 void bed()
 {
    system("cls");
    print("八个小时过去了");
    getchar();
    play.sleep=8;
}
  int lumin=0;
  void huo()
  {
    if(lumin<=0){
        print("火炉空荡荡的");
          cout<<endl;
      }else{
        print("火炉正在燃烧,能烧");
        printf("%d分钟\n",lumin);

      }
      printf("**************************************\n1.放纸         2.离开\n");
      int n=getch()-'0';
      switch(n){
        case 1:{
            if(play.paper>0){
                system("cls");
                tzhi:
                print("放多少斤?");
                printf("        你有%d斤\n",play.paper);
                  cin>>n;
                  if(n>play.paper){
                    print("纸不够\n");
                      system("cls");
                      goto tzhi;
                  }else{
                    print("你放入了纸,炉内有火了\n");
                  lumin+=n*100;
                  }

              }
            break;
          }
      }
      system("cls");
  }
string name[2]={"【垃圾场】","【城市】"};
string maps[2][50]={{{"____________________________________________"},//0
                     {"|                   |                      |"},//1
                     {"|                   |                      |"},//2
                     {"|                   |                      |"},//3
                     {"|                   |                      |"},//4
                     {"|                   |                      |"},//5
                     {"|                   |                      |"},//6
                     {"|                   |                      |"},//7
                     {"|___________________|_______ 收废品________|"},//8
                     {"|*******************|__________-___________|"},//9
                     {"|  床   炉**********|                      |"},//10
                     {" @                                         |"},//11
                     {"|*******************|                      |"},//12
                     {"|*******************|                      |"},//13
                     {"|___________________|__________-___________|"},//14
                     {"|                   |_______肥料站_________|"},//15
                     {"|                   |                      |"},//16
                     {"|                   |                      |"},//17
                     {"|                   |                      |"},//18
                     {"|___________________|______________________|"}},//19
                     //0123456789012345678901234567890123456789012
                    {{"____________________________________________"},//1
                     {"|*******************************| |      |"},//2
                     {"|********************* 服 * 医 *| |      |"},//3
                     {"|    卢本伟大饭店    * 装 *    *| |      |"},//4
                     {"|********************* 店 * 院 *| |      |"},//5
                     {"|**********--**********--***--**| |      |"},//6
                     {"|                               | |      |"},//7
                     {"|                               | |      |"},//8
                     {"|                               | |      |"},//9
                     {"|                               | |******|"},//10
                     {"|                                       @|"},//11
                     {"|                               | |******|"},//12
                     {"|                               | |      |"},//13
                     {"|                               | |      |"},//14
                     {"|                               | |      |"},//15
                     {"|                            ***| |      |"},//16
                     {"|                            *垃| |      |"},//17
                     {"|                            |圾| |      |"},//18
                     {"|____________________________*桶|_|______|"}}};//19

void gto(int n)
{
    if(n==0){
        x=11,y=0;
    }
    if(n==1){
        x=10,y=40;
    }
    where=n;
}
    int mintmp=play.min;
void shike()
{
    if(abs(play.min-mintmp)>=10){
                play.goshift++;
                play.food--;
                play.drink--;
                mintmp=play.min;
            }
        if(play.min>=60){
            play.hr+=play.min/60;
            play.sleep-=0.5*play.min/60;
            play.min%=60;
        }
        if(play.hr>24){
            play.day+=play.hr/24;
            play.hr%=24;
        }
        switch(play.month)
        {
            case 1:{
                if(play.day>31){
                    play.month+=play.day/31;
                    play.day%=31;
                }
            }
            case 2:{
                if(run(play.year)){
                    if(play.day>29){
                        play.month+=play.day/29;
                        play.day%=29;
                    }
                }
                else{
                    play.month+=play.day/28;
                    play.day%=28;
                }
            }
            case 3:{
                if(play.day>31){
                    play.month+=play.day/31;
                    play.day%=31;
                }
            }
            case 4:{
                if(play.day>30){
                    play.month+=play.day/30;
                    play.day%=30;
                }
            }
            case 5:{
                if(play.day>31){
                    play.month+=play.day/31;
                    play.day%=31;
                }
            }
            case 6:{
                if(play.day>30){
                    play.month+=play.day/30;
                    play.day%=30;
                }
            }
            case 7:{
                if(play.day>31){
                    play.month+=play.day/31;
                    play.day%=31;
                }
            }
            case 8:{
                if(play.day>31){
                    play.month+=play.day/31;
                    play.day%=31;
                }
            }
            case 9:{
                if(play.day>30){
                    play.month+=play.day/30;
                    play.day%=30;
                }
            }
            case 10:{
                if(play.day>31){
                    play.month+=play.day/31;
                    play.day%=31;
                }
            }
            case 11:{
                if(play.day>30){
                    play.month+=play.day/30;
                    play.day%=30;
                }
            }
            case 12:{
                if(play.day>31){
                    play.month+=play.day/31;
                    play.day%=31;
                    if(play.month>12){
                        play.month%=12;
                        play.year++;
                        play.old++;
                    }
                }
            }
        }
}
float wen[4]={0,0.12,-0.06,-0.12};
void tiwen()
{
    for(int i=0;i<4;i++)play.hot+=play.clothesmath[i][play.body[i]];
    if(play.month==3||play.month==4||play.month==5)play.tiwen+=play.hot*0.01;
      if(play.month==6||play.month==7||play.month==8)play.tiwen+=play.hot*0.01+0.12;
      if(play.month==9||play.month==10||play.month==11)play.tiwen+=play.hot*0.01-0.06;
      if(play.month==12||play.month==1||play.month==2)play.tiwen+=play.hot*0.01-0.12;

}
void run_all()
{
    play.min+=1;
    lumin-=1;
    if(lumin<=0)lumin=0;
    is_ill(4);
    tiwen();
}
void look_ill()
{
    system("cls");
    for(int i=0;i<3;i++){
        cout<<play.illnames[i]<<":";
        if(play.ill[i])cout<<"有";
        else cout<<"无";
        cout<<endl;
    }
    for(int i=0;i<20;i++)cout<<"*";
    cout<<endl;
    for(int i=0;i<4;i++)cout<<play.yaonames[i]<<":"<<play.Hasyao[i];
    use_y((_getch()-'0'));
}
void tai()
{
    system("cls");
    cout<<"睡眠:";
    if(play.sleep>=5)cout<<"正常";
    else if(play.sleep<5&&play.sleep>0)cout<<"良好";
    else if(play.sleep<=0&&play.sleep>=-4)cout<<"需要";
    else cout<<"急需";
    cout<<endl;
    cout<<"饥饿:"<<play.food<<"/"<<play.maxfood<<endl;
    cout<<"口渴:"<<play.drink<<"/"<<play.maxdrink<<endl;
    cout<<"臭味:"<<play.stin<<"/"<<play.maxstin<<endl;
    cout<<"体温:"<<play.tiwen<<endl;
    cout<<"纸:"<<play.paper<<endl;
    cout<<"易拉罐:"<<play.guan<<endl;
    cout<<"答辩:"<<play.shift<<endl;
    cout<<"餐厨:"<<play.afood<<endl;
    cout<<"1.衣服"<<endl<<"2.疾病";
    int a=_getch();
    switch(a)
    {
        case '1':clothes();
        case '2':look_ill();
    }
     system("cls");
 }
void jiao()//该函数用于纠正超出的数值
{
	if(play.food>100)play.food=100;
	if(play.drink>100)play.drink=100;
	if(play.HP>100)play.HP=100;
	if(play.stin>100)play.stin=100;
	if(play.tiwen>42.0)play.tiwen=42.0;
 }
int main()
{
    //where用来记录在哪个地图
    char go;
    system("title 流浪汉");
    bool CAR=0;printf("\n\n\n\n\n\n\n\n                                                      ");
    print("流浪汉模拟器");
    getchar();
    system("cls");
    print("你的名字·······");
    cin>>play.names;
    system("cls");
     print("你叫");
     print(play.names);
     print(",三十多岁,是一个一个流浪汉,你又是从垃圾场醒来...");
     Sleep(500);
     system("cls");
     print("按下e以查看游戏按键说明");
     Sleep(1000);
     system("cls");
     while(1)
     {
        shike();
    //=====================================================================
        is_ill(1);
     if(play.HP<=0||play.food<=0||play.drink<=0||abs(play.tiwen-42.000)<=1e-6)break;
      cout<<name[where]<<"   " ;
      cout<<"NAME IS "<<play.names<<endl;
      cout<<play.year<<'/'<<play.month<<'/'<<play.day<<"  " ;
       if(play.month==3||play.month==4||play.month==5)cout<<"SPRING"<<endl;
      if(play.month==6||play.month==7||play.month==8)cout<<"SUMMER"<<endl;
      if(play.month==9||play.month==10||play.month==11)cout<<"FALL"<<endl;
      if(play.month==12||play.month==1||play.month==2)cout<<"WINTER"<<endl;
      cout<<"TIME:"<<play.hr<<':';if(play.min<10)cout<<0;
     cout<<play.min<<"  ";
     if(play.hr>=6&&play.hr<11)cout<<"  morning";
     if(play.hr>=11&&play.hr<=13)cout<<"   noon";
     if(play.hr>=14&&play.hr<=18)cout<<"    after noon";
     if(play.hr>=19&&play.hr<=24)cout<<"   the evening";
     if(play.hr>0&&play.hr<=5)cout<<"   morning";

      cout<<endl<<"MONEY:"<<play.money<<"$"<<endl;
      printf("HP:%d/%d\n",play.HP,play.maxHP);
        for(int i=0;i<20;i++)
        {
            cout<<maps[where][i]<<endl;
         }
         if(play.goshift>=100)goshift(3);
         char qwe=_getch();
         system("cls");
         switch(qwe){
            case 'w':if (maps[where][x-1][y]==' '){swap(maps[where][x-1][y],maps[where][x][y]);x-=1;run_all();};break;
            case 'a':if (maps[where][x][y-1]==' '){swap(maps[where][x][y-1],maps[where][x][y]);y-=1;run_all();};break;
            case 's':if (maps[where][x+1][y]==' '){swap(maps[where][x+1][y],maps[where][x][y]);x+=1;run_all();};break;
            case 'd':if (maps[where][x][y+1]==' '){swap(maps[where][x][y+1],maps[where][x][y]);y+=1;run_all();};break;
            case 'q':{
                switch(where){
                    case 0:{
                        if(x==11&&y==0)gto(1);
                        play.min+=5;
                        lumin-=5;
                        break;
                     }
                     case 1:{
                        if(x==10&&y==40)gto(0);play.min+=5;lumin-=5;
                        break;
                     }
                 }
                break;
             }
             case 'l':{
                system("cls");
                printf("【W】【A】【S】【D】以移动\n在地图边缘按【Q】以切换地图\n【F】以交互\n【E】查看状态\n【R】以拉屎\n【C】以膜拜");
                getchar();
                system("cls");
                break;
             }
             case 'f':{
                switch(where){
                    case 0:{
                        if(y==31&&x==10)feipin();play.min+=5;break;
                        if(y==31&&x==13)fieliao();break;
                        if(y==3&&x==11||y==4&&x==11)bed();break;
                        if(y==8&&x==11||y==9&&x==11)huo();break;
                     }
                     case 1:{
                        if(y==28&&x==6||y==29&&x==6)hospital();
                        if(y==24&&x==6||y==23&&x==6)shopcloth();
                        if(x==17&&y==4||x==17&&y==28)trash();is_ill(2);
                        if(x==6&&y==11||x==6&&y==12)lbw();
                        break;
                     }
                 }
                break;
             }
             case 'e':{
                tai();
                break;
             }
             case 'r':if(play.goshift>=80)goshift(2);
             case 'c':system("cls");printf("你膜拜了jiangjunyi2023");play.money+=50;Sleep(100);system("cls");
         }
     }
     system("cls");
     print("你死了");
     cout<<endl;
     print("享年:");
     cout<<play.old<<"岁";
     return 0;
 }

#include<cmath> //jiangjunyi2023编写 #include<time.h>//23/06/17 更新疾病系统 #include<cstdio>//23/07/10 统一标点,优化提示 #include<iostream> #include<cstring> #include<windows.h> #include<conio.h> #include<string> #include<cstdlib> #include<bits/stdc++.h> #include<iostream> #include<iomanip> #include<cstdio> #include<stdio.h> #include<string> #include<cstring> #include<istream> #include<ostream> #include<map> #include<vector> #include<queue> #include<cmath> #include<windows.h> #include<algorithm> #include<time.h> #include<ctime> #include<stdlib.h> #include<cstdlib> #include<stddef.h> #include<stdint.h> #include<stdbool.h> #include<math.h> #define getchar() getch() using namespace std; string maps[110]={{”_______________________________________________________________________________________________”}, {”| |”}, {”| |”}, {”| |”}, {”| |”}, {”| |”}, {”| |”}, {”| |”}, {”| |”}, {”| |”}, {”| |”}, {”| |”}, {”| |”}, {”| |”}, {”| |”}, {”| |”}, {”| |”}, {”| |”}, {”| |”}, {”| |”}, {”| |”}, {”| |”}, {”| |”}, {”| |”}, {”| |”}, {”| |”}, {”| |”}, {”| |”}, {”| |”}, {”| |”}, {”| |”}, {”| |”}, {”| |”}, {”| |”}, {”| |”}, {”| |”}, {”| |”}, {”| |”}, {”| |”}, {”| |”}, {”| |”}, {”| |”}, {”| |”}, {”| |”}, {”| |”}, {”| |”}, {”| |”}, {”| |”}, {”| |”}, {”| |”}, {”| |”}, {”| |”}, {”| |”}, {”| |”}, {”| |”}, {”| |”}, {”| |”}, {”| |”}, {”| |”}, {”| |”}, {”| |”}, {”| |”}, {”| |”}, {”| |”}, {”| |”}, {”| |”}, {”| |”}, {”| |”}, {”| |”}, {”| |”}, {”| |”}, {”| |”}, {”| |”}, {”| |”}, {”| |”}, {”| |”}, {”| |”}, {”| |”}, {”| |”}, {”| |”}, {”| |”}, {”| |”}, {”| |”}, {”| |”}, {”| |”}, {”| |”}, {”| |”}, {”| |”}, {”| |”}, {”| |”}, {”| |”}, {”| |”}, {”| |”}, {”| |”}, {”| |”}, {”| |”}, {”| |”}, {”| |”}, {”| |”}, {”| |”}, {”|______________________________________________________________________________________________|”}}; int main() {

代码
 return 0;

}

原文