生活大冒险(3)

目录

上期回顾

本期目标

实现讲解

成功实现

代码源码


上期回顾

成功完善登录

成功实现s+y防摁错

本期目标

开启第一章

实现讲解

才注意到上次没搞完,先加上

	cout << endl << "    ";
	cout << "注册成功!" << endl << endl;
	system("pause");
	system("cls");
	cout << "请确认" << endl << endl;
	cout << "    姓名:" << name << endl << endl;
	cout << "    性别:";
	if(age == 1){
		cout << "男" << endl; 
	}else{
		cout << "女" << endl; 
	}

把主页面搞一下

    system("pause");
	Sleep(300);
	system("cls");
	cout << "生活大冒险欢迎您," << name << endl;
	system("pause");
	system("cls"); 
	cout << "            生活大冒险2.0" << endl;
	cout << "开始游戏[1]  查看信息[2]   退出[3]" << endl;

基本信息

    //基本信息-----
	char ch2;
	int Q = 0;
	int car = 0;
	int home = 0;
	int LV = 1;
	int jindu = 0;
	//-------------

然后选择,不说了,没啥知识点。其实有,之前讲过了。

ch2 = getch();
	if(ch2 == '2'){
		system("cls");
		cout << "级别:LV." << LV << endl;
		cout << "现金:" << Q << endl;
		cout << "车辆辆数:" << car << endl;
		cout << "房子数:" << home << endl;
		cout << "任务完成进度:" << jindu << "%" << endl;
		cout << "退出[1]" << endl;
		ch2 = getch();
		if(ch2 == '1'){
			system("cls");
		}else{
			system("cls");
			while(1){
				system("cls");
				cout << "级别:LV." << LV << endl;
				cout << "现金:" << Q << endl;
				cout << "车辆辆数:" << car << endl;
				cout << "房子数:" << home << endl;
				cout << "任务完成进度:" << jindu << "%" << endl;
				cout << "退出[1]" << endl;
				ch2 = getch();
				if(ch2 == '1'){
					system("cls");
					break;
				}else{
					system("cls");
				}
			}
		}
	}else if(ch2 == '3'){
		cout << "退出" << endl;
		return 0; 
	}else if(ch2 != '1'){
		while(1){
			system("cls");
			cout << "            生活大冒险2.0" << endl;
			cout << "开始游戏[1]  查看信息[2]   退出[3]" << endl;
			ch2 = getch();
			if(ch2 == '2'){
				system("cls");
				cout << "级别:LV." << LV << endl;
				cout << "现金:" << Q << endl;
				cout << "车辆辆数:" << car << endl;
				cout << "房子数:" << home << endl;
				cout << "任务完成进度:" << jindu << "%" << endl;
				cout << "退出[1]" << endl;
				ch2 = getch();
				if(ch2 == '1'){
					system("cls");
				}else{
					system("cls");
					while(1){
						system("cls");
						cout << "级别:LV." << LV << endl;
						cout << "现金:" << Q << endl;
						cout << "车辆辆数:" << car << endl;
						cout << "房子数:" << home << endl;
						cout << "任务完成进度:" << jindu << "%" << endl;
						cout << "退出且开始游戏[1]" << endl;
						ch2 = getch();
						if(ch2 == '1'){
							system("cls");
							break;
						}else{
							system("cls");
						}
					}
				}
				break;
			}else if(ch2 == '3'){
				cout << "退出" << endl;
				return 0; 
			}else if(ch2 != '1' && ch2 != '2' && ch2 != '3'){
				system("cls");
			}else{
				system("cls");
				break;
			}
		}
	}

加载界面

	cout << "正在进入游戏";
	Sleep(300);
	cout << ".";
	Sleep(500);
	cout << ".";
	Sleep(500);
	cout << ".";
	Sleep(500);
	system("cls");

然后用AI搞一个名字,开始剧情

	cout << "按任意键继续剧情" << endl;
	system("pause");
	system("cls");
	cout << "林浩然:" << name << ",好久不见啊" << endl;
	ch3 = getch();
	cout << "我:你是?" << endl;
	ch3 = getch();
	cout << "林浩然:我是你的大学同学啊?怎么,不记得我啦" << endl;
	ch3 = getch();
	cout << "我:哦!原来是你呀" << endl;
	ch3 = getch();
	cout << "我:现在你怎么样了?" << endl;
	ch3 = getch();
	cout << "林浩然:还行吧!" << endl;
	ch3 = getch();
	cout << "我:你做的什么工作啊?" << endl;
	ch3 = getch();
	cout << "林浩然:就是在事瓦工作啊!" << endl;
ch3 = getch();
	cout << "我:哦,真不错!" << endl;
	ch3 = getch();
	cout << "林浩然:你呢?" << endl;
	ch3 = getch();
	cout << "我:我还没找到呢,这不正在找这呢" << endl;
	ch3 = getch();
	cout << "林浩然:要不你先去干超市,外卖什么的,搞点启动资金吧!" << endl;
	ch3 = getch();
	cout << "林浩然:然后搞点大事业" << endl;
	ch3 = getch();
	cout << "我:好!" << endl;
	ch3 = getch();
	system("cls"); 
	cout << "任务目标:" << endl;
	cout << "    成功选择并应聘成功一项职业  [  ]" << endl;
	system("pause");
	system("cls"); 
	cout << "选择哪个好呢?" << endl;
	cout << endl;
	cout << "外卖[1]  超市[2]" << endl;
	ch3 = getch();
	if(ch3 == '2'){
		cout << "就它了!" << endl;
		system("pause");
		system("cls");
		cout << "你来到了买房区" << endl;
		ch3 = getch(); 
		cout << "工作人员:你好,请问你要哪一套房子?" << endl;
		ch3 = getch();
		cout << "我:我要大一点的" << endl;
		ch3 = getch();
		cout << "工作人员:这里有一张菜单,您可以看看" << endl;
		ch3 = getch();
		cout << "我:房子好贵啊,最小的都有10万多!" << endl;
		ch3 = getch();
		cout << "我:算了,还是干外卖吧" << endl;
	}else if(ch3 == '1'){
		cout << "就选他了" << endl; 
	}else{
		while(1){
			system("cls");
			cout << "选择哪个好呢?" << endl;
			cout << endl;
			cout << "外卖[1]  超市[2]" << endl;
			char ch2;
			ch2 = getch();
			if(ch2 == '2'){
				cout << "就它了!" << endl;
				system("pause");
				system("cls");
				cout << "你来到了买房区" << endl;
				ch3 = getch(); 
				cout << "工作人员:你好,请问你要哪一套房子?" << endl;
				ch3 = getch();
				cout << "我:我要大一点的" << endl;
				ch3 = getch();
				cout << "工作人员:这里有一张菜单,您可以看看" << endl;
				ch3 = getch();
				cout << "我:房子好贵啊,最小的都有10万多!" << endl;
				ch3 = getch();
				cout << "我:算了,还是干外卖吧" << endl;
				break;
			}else if(ch2 == '1'){
				cout << "就选他了" << endl;
				sheng += 100;
				break; 
			}else{
				cout << "选择哪个好呢?" << endl;
				cout << endl;
				cout << "外卖[1]  超市[2]" << endl;
			}	
		}		
	}

注意了,这里的system("pause");运行状态是这样的:

详细还是上次的连接

system的用法,多样用法、有趣的system、关机自制_system命令用法-CSDN博客

今天先更这么多

成功实现

开启第一章

剧情更了一组

代码源码

#include<bits/stdc++.h>
#include<windows.h>
#include<conio.h>
using namespace std;
int main(){
	int sheng = 0;
	system("title 生活大冒险");
	system("color 90");
	cout << "欢迎来到生活大冒险" << endl;
	cout << endl << endl << endl << endl;
	cout << "              加载中" << endl;
	cout << "------------------------------------------" << endl;
	cout << "|                                        |    %0" << endl;
	cout << "------------------------------------------" << endl;
	Sleep(300);
	system("cls"); 
	cout << "欢迎来到生活大冒险" << endl;
	cout << endl << endl << endl << endl;
	cout << "              加载中" << endl;
	cout << "------------------------------------------" << endl;
	cout << "|//|                                 |    %20" << endl;
	cout << "------------------------------------------" << endl;
	Sleep(300);
	system("cls");
	cout << "欢迎来到生活大冒险" << endl;
	cout << endl << endl << endl << endl;
	cout << "              加载中" << endl;
	cout << "------------------------------------------" << endl;
	cout << "|//|                     |    %50" << endl;
	cout << "------------------------------------------" << endl;
	Sleep(500);
	system("cls");
	cout << "欢迎来到生活大冒险" << endl;
	cout << endl << endl << endl << endl;
	cout << "              加载中" << endl;
	cout << "------------------------------------------" << endl;
	cout << "|///|            |    %70" << endl;
	cout << "------------------------------------------" << endl;
	Sleep(700);
	system("cls");
	cout << "欢迎来到生活大冒险" << endl;
	cout << endl << endl << endl << endl;
	cout << "              加载中" << endl;
	cout << "------------------------------------------" << endl;
	cout << "||   %100" << endl;
	cout << "------------------------------------------" << endl;
	Sleep(1000);
	system("pause");
	system("cls");
	cout << "欢迎来到生活大冒险" << endl;
	cout << endl;
	cout << "查看前言 [1]    不查看 [2]" << endl;
	char ch;
	cout << endl;
	ch = getch();
	if(ch == '1'){
		system("cls");
		while(1){
			cout << "欢迎来到生活大冒险" << endl;
			cout << endl;
			cout << "版本:2.0版" << endl;
			cout << "测试:否" << endl;
			cout << "关于游戏:" << endl;
			cout << "    本游戏为文字游戏,会有由文字或字符组成的图片。" << endl;
			cout << "关于更新:" << endl;
			cout << "    更新了数字按错会失败的问题" << endl;
			cout << endl;
			cout << "退出按1" << endl;
			char ch2;
			ch2 = getch();
			if(ch2 == '1'){
				system("cls");
				cout << "欢迎来到生活大冒险" << endl;
				cout << endl;
				break;
			}else{
				system("cls");
			}
		}
		
	}else{
		system("cls");
	} 
	cout << "你是?" << endl;
	cout << endl;
	cout << "1.玩过1.0版 [1]    2.没玩过1.0版[2]" << endl;
	char ch3;
	ch3 = getch();
	if(ch3 == '1'){ 
		system("cls"); 
	}else if(ch3 == '2'){
		cout << "建议你去玩一下1.0版~" << endl;
		system("cls"); 
	}else{
		while(1){
			if(ch3 == '1'){
				system("cls");
				break;
			}else if(ch3 == '2'){
				cout << "建议你去玩一下1.0版~" << endl;
				system("cls");
			}else{
				system("cls");
			}
		}
	}
	cout << "欢迎来到生活大冒险" << endl;
	system("color 70");
	cout << "先注册一下吧!" << endl;
	string name;
	cout << endl;
	cout << "    名字:";
	cin >> name;
	cout << endl;
	cout << "    性别:[1]男   [2]女" << endl;
	char ch4;
	int age; 
	ch4 = getch();			
	if(ch4 == '1'){
		system("cls");
		cout << "欢迎来到生活大冒险" << endl;
		cout << "先注册一下吧!" << endl << endl;
		cout << "    名字:" << name << endl << endl;
		cout << "    性别:男" << endl;
		age = 1;
	}else if(ch4 == '2'){
		system("cls");
		cout << "欢迎来到生活大冒险" << endl;
		cout << "先注册一下吧!" << endl << endl;
		cout << "    名字:" << name << endl << endl;
		cout << "    性别:女" << endl;
		age = 2;
	}else{
		while(1){
			cout << "欢迎来到生活大冒险" << endl;
			cout << "先注册一下吧!" << endl << endl;
			cout << "    名字:" << name << endl << endl;
			cout << "    性别:[1]男   [2]女" << endl;
			char ch5;
			ch5 = getch();
			if(ch5 == '1'){
				system("cls");
				cout << "欢迎来到生活大冒险" << endl;
				cout << "先注册一下吧!" << endl << endl;
				cout << "    名字:" << name << endl << endl;
				cout << "    性别:男" << endl;
				age = 1;
				break;
			}else if(ch5 == '2'){
				system("cls");
				cout << "欢迎来到生活大冒险" << endl;
				cout << "先注册一下吧!" << endl << endl;
				cout << "    名字:" << name << endl << endl;
				cout << "    性别:女" << endl;
				age = 2;
				break;
			}else{
				system("cls");
			}
		}
	}
	cout << endl << "    ";
	cout << "注册成功!" << endl << endl;
	system("pause");
	system("cls");
	cout << "请确认" << endl << endl;
	cout << "    姓名:" << name << endl << endl;
	cout << "    性别:";
	if(age == 1){
		cout << "男" << endl; 
	}else{
		cout << "女" << endl; 
	}
	system("pause");
	Sleep(300);
	system("cls");
	cout << "生活大冒险欢迎您," << name << endl;
	system("pause");
	system("cls"); 
	cout << "            生活大冒险2.0" << endl;
	cout << "开始游戏[1]  查看信息[2]   退出[3]" << endl;
	//基本信息-----
	char ch2;
	int Q = 0;
	int car = 0;
	int home = 0;
	int LV = 1;
	int jindu = 0;
	//-------------
	ch2 = getch();
	if(ch2 == '2'){
		system("cls");
		cout << "级别:LV." << LV << endl;
		cout << "现金:" << Q << endl;
		cout << "车辆辆数:" << car << endl;
		cout << "房子数:" << home << endl;
		cout << "任务完成进度:" << jindu << "%" << endl;
		cout << "退出[1]" << endl;
		ch2 = getch();
		if(ch2 == '1'){
			system("cls");
		}else{
			system("cls");
			while(1){
				system("cls");
				cout << "级别:LV." << LV << endl;
				cout << "现金:" << Q << endl;
				cout << "车辆辆数:" << car << endl;
				cout << "房子数:" << home << endl;
				cout << "任务完成进度:" << jindu << "%" << endl;
				cout << "退出[1]" << endl;
				ch2 = getch();
				if(ch2 == '1'){
					system("cls");
					break;
				}else{
					system("cls");
				}
			}
		}
	}else if(ch2 == '3'){
		cout << "退出" << endl;
		return 0; 
	}else if(ch2 != '1'){
		while(1){
			system("cls");
			cout << "            生活大冒险2.0" << endl;
			cout << "开始游戏[1]  查看信息[2]   退出[3]" << endl;
			ch2 = getch();
			if(ch2 == '2'){
				system("cls");
				cout << "级别:LV." << LV << endl;
				cout << "现金:" << Q << endl;
				cout << "车辆辆数:" << car << endl;
				cout << "房子数:" << home << endl;
				cout << "任务完成进度:" << jindu << "%" << endl;
				cout << "退出[1]" << endl;
				ch2 = getch();
				if(ch2 == '1'){
					system("cls");
				}else{
					system("cls");
					while(1){
						system("cls");
						cout << "级别:LV." << LV << endl;
						cout << "现金:" << Q << endl;
						cout << "车辆辆数:" << car << endl;
						cout << "房子数:" << home << endl;
						cout << "任务完成进度:" << jindu << "%" << endl;
						cout << "退出且开始游戏[1]" << endl;
						ch2 = getch();
						if(ch2 == '1'){
							system("cls");
							break;
						}else{
							system("cls");
						}
					}
				}
				break;
			}else if(ch2 == '3'){
				cout << "退出" << endl;
				return 0; 
			}else if(ch2 != '1' && ch2 != '2' && ch2 != '3'){
				system("cls");
			}else{
				system("cls");
				break;
			}
		}
	}
	cout << "正在进入游戏";
	Sleep(300);
	cout << ".";
	Sleep(500);
	cout << ".";
	Sleep(500);
	cout << ".";
	Sleep(500);
	system("cls");
	//char ch3;
	cout << "按任意键继续剧情" << endl;
	system("pause");
	system("cls");
	cout << "林浩然:" << name << ",好久不见啊" << endl;
	ch3 = getch();
	cout << "我:你是?" << endl;
	ch3 = getch();
	cout << "林浩然:我是你的大学同学啊?怎么,不记得我啦" << endl;
	ch3 = getch();
	cout << "我:哦!原来是你呀" << endl;
	ch3 = getch();
	cout << "我:现在你怎么样了?" << endl;
	ch3 = getch();
	cout << "林浩然:还行吧!" << endl;
	ch3 = getch();
	cout << "我:你做的什么工作啊?" << endl;
	ch3 = getch();
	cout << "林浩然:就是在事瓦工作啊!" << endl;
ch3 = getch();
	cout << "我:哦,真不错!" << endl;
	ch3 = getch();
	cout << "林浩然:你呢?" << endl;
	ch3 = getch();
	cout << "我:我还没找到呢,这不正在找这呢" << endl;
	ch3 = getch();
	cout << "林浩然:要不你先去干超市,外卖什么的,搞点启动资金吧!" << endl;
	ch3 = getch();
	cout << "林浩然:然后搞点大事业" << endl;
	ch3 = getch();
	cout << "我:好!" << endl;
	ch3 = getch();
	system("cls"); 
	cout << "任务目标:" << endl;
	cout << "    成功选择并应聘成功一项职业  [  ]" << endl;
	system("pause");
	system("cls"); 
	cout << "选择哪个好呢?" << endl;
	cout << endl;
	cout << "外卖[1]  超市[2]" << endl;
	ch3 = getch();
	if(ch3 == '2'){
		cout << "就它了!" << endl;
		system("pause");
		system("cls");
		cout << "你来到了买房区" << endl;
		ch3 = getch(); 
		cout << "工作人员:你好,请问你要哪一套房子?" << endl;
		ch3 = getch();
		cout << "我:我要大一点的" << endl;
		ch3 = getch();
		cout << "工作人员:这里有一张菜单,您可以看看" << endl;
		ch3 = getch();
		cout << "我:房子好贵啊,最小的都有10万多!" << endl;
		ch3 = getch();
		cout << "我:算了,还是干外卖吧" << endl;
	}else if(ch3 == '1'){
		cout << "就选他了" << endl; 
	}else{
		while(1){
			system("cls");
			cout << "选择哪个好呢?" << endl;
			cout << endl;
			cout << "外卖[1]  超市[2]" << endl;
			char ch2;
			ch2 = getch();
			if(ch2 == '2'){
				cout << "就它了!" << endl;
				system("pause");
				system("cls");
				cout << "你来到了买房区" << endl;
				ch3 = getch(); 
				cout << "工作人员:你好,请问你要哪一套房子?" << endl;
				ch3 = getch();
				cout << "我:我要大一点的" << endl;
				ch3 = getch();
				cout << "工作人员:这里有一张菜单,您可以看看" << endl;
				ch3 = getch();
				cout << "我:房子好贵啊,最小的都有10万多!" << endl;
				ch3 = getch();

你看看我多好

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值