目录
第四弹来啦,我每天会更新3~5个小游戏,如果觉得我更得太慢的可以直接下载资源,完全免费哟~
创意类
13.人生模拟器(2)
#include<stdio.h>
#include<stdlib.h>//void exit(int status)使程序正常终止。
#include<Windows.h>//延迟函数Sleep();
#define M 10
#define N 100
#define time 444
void caiDan(){
printf("*****人生模拟器*****\n");
printf("*****1.开始游戏*****\n");
printf("*****2.结束游戏*****\n");
}
void tianFu_shuXing(int xuanZe,char TianFu[M][N],int* zhiHui, int* tiZhi, int* jiaJing, int* meiLi,int z,int t,int j,int m){
printf("你选择的天赋是:\n");
printf("%s\n", TianFu[xuanZe - 1]);
*zhiHui +=z;
*tiZhi +=t;
*jiaJing +=j;
*meiLi +=m;
}
void tianFu(int* zhiHui, int* tiZhi, int* jiaJing, int* meiLi) {
int xuanZe;
char TianFu[M][N] =
{ "1.万中无一(全属性+999)","2.绝世奇才(全属性+999)",
"3.气质选手(魅力+999)" ,"4.蠢货一个(智力-111)",
"5.天生残疾(体质 - 2)","6.幸运儿(所有属性 +1)",
"7.十死无生(体质 - 10)","8.家运不顺(家境 - 2)",
"9.头着地(智力 - 2)","10.胎教(智力 + 1)"};
for (int i=0;i<M;i++)
{
printf("%s\n", TianFu[i]);
}
printf("请选择天赋:\n");
scanf("%d", &xuanZe);
switch (xuanZe)
{
case 1:
tianFu_shuXing(xuanZe, TianFu,zhiHui,tiZhi,jiaJing,meiLi, 999, 999, 999, 999);
break;
case 2:
tianFu_shuXing(xuanZe, TianFu,zhiHui,tiZhi,jiaJing,meiLi, 999, 999, 999, 999);
break;
case 3:
tianFu_shuXing(xuanZe, TianFu,zhiHui,tiZhi,jiaJing,meiLi, 0, 0, 0, 999);
break;
case 4:
tianFu_shuXing(xuanZe, TianFu,zhiHui,tiZhi,jiaJing,meiLi, -111, 0, 0, 0);
break;
case 5:
tianFu_shuXing(xuanZe, TianFu,zhiHui,tiZhi,jiaJing,meiLi, 0, -2, 0, 0);
break;
case 6:
tianFu_shuXing(xuanZe, TianFu,zhiHui,tiZhi,jiaJing,meiLi, 1, 1, 1, 1);
break;
case 7:
tianFu_shuXing(xuanZe, TianFu,zhiHui,tiZhi,jiaJing,meiLi, 0, -10, 0, 0);
break;
case 8:
tianFu_shuXing(xuanZe, TianFu,zhiHui,tiZhi,jiaJing,meiLi, 0, 0, 0, -2);
break;
case 9:
tianFu_shuXing(xuanZe, TianFu,zhiHui,tiZhi,jiaJing,meiLi, -2, 0, 0, 0);
break;
case 10:
tianFu_shuXing(xuanZe, TianFu,zhiHui,tiZhi,jiaJing,meiLi, +1, 0, 0, 0);
break;
default:
break;
}
printf("智力:%d 体质:%d 家境:%d 魅力:%d\n",*zhiHui,*tiZhi,*jiaJing,*meiLi);
}
void renSheng_liCheng(int* zhiHui, int* tiZhi, int* jiaJing, int* meiLi) {
system("cls");
printf("0岁,你出生了!\n");
if (*zhiHui < 0 || *tiZhi < 0 || *jiaJing<0|| *meiLi<0){
printf("0岁,大聪明,你死的很安详!\n");
}
else if (*zhiHui >= 999 || *tiZhi >=999 || *jiaJing >=999 || *meiLi >=999){
printf("0岁,天妒英才,你受到了天谴!\n");
printf("0岁,你理所当然的死了!\n");
}
else if (*zhiHui >= 0 && *tiZhi >= 0 && *jiaJing >= 0 && *meiLi >= 0
&& *zhiHui < 999 &&*tiZhi < 999&& *jiaJing < 999&&*meiLi < 999){
//Sleep()为头文件#include<windows.h>中的延迟函数;
if (*zhiHui+*tiZhi+*jiaJing+*meiLi<=50&&*meiLi>20){
printf("1岁,你很可爱!\n");
Sleep(time);
printf(".............\n");
Sleep(time);
printf("7岁,你有点小帅!\n隔壁丫头有点喜欢你!\n");
Sleep(time);
printf(".............\n");
Sleep(time);
printf("18岁,你的成绩不是很理想,智慧-1\n");
Sleep(time);
*zhiHui -= 1;
printf(".............\n");
Sleep(time);
printf("20岁,有富婆想要包养你!魅力+20\n");
Sleep(time);
*meiLi += 20;
printf(".............\n");
Sleep(time);
printf("25岁,你向现实低了头魅力+30\n");
Sleep(time);
*meiLi += 30;
printf(".............\n");
Sleep(time);
printf("80岁,你在忧郁中死去!\n");
Sleep(time);
}
else if (*zhiHui + *tiZhi + *jiaJing + *meiLi <= 50 && *tiZhi>20){
printf("1岁,你很强壮!\n");
Sleep(time);
printf(".............\n");
Sleep(time);
printf("7岁,你有点小壮!\n隔壁丫头有点喜欢你!\n");
Sleep(time);
printf(".............\n");
Sleep(time);
printf("18岁,你的成绩不是很理想,智慧-1\n");
Sleep(time);
*zhiHui -= 1;
printf(".............\n");
Sleep(time);
printf("20岁,有漂亮富婆想要包养你!体质+20\n");
Sleep(time);
*tiZhi += 20;
printf(".............\n");
Sleep(time);
printf("25岁,你向现实低了头魅力+30\n");
*meiLi += 30;
printf(".............\n");
Sleep(time);
printf("80岁,你在忧郁中死去!\n");
Sleep(time);
}
else if (*zhiHui + *tiZhi + *jiaJing + *meiLi <= 50 && *jiaJing>20){
printf("1岁,你很富有!\n");
Sleep(time);
printf(".............\n");
Sleep(time);
printf("7岁,你每天从800米的大床上醒来\n隔壁丫头有点喜欢你!\n");
Sleep(time);
printf(".............\n");
Sleep(time);
printf("18岁,你的成绩不是很理想,智慧-1\n");
Sleep(time);
*zhiHui -= 1;
printf(".............\n");
Sleep(time);
printf("20岁,你低调时有漂亮富婆想要包养你!体质+20\n");
Sleep(time);
*tiZhi += 20;
printf("21岁,你摊牌了,你包养了想要包养你的富婆!\n");
Sleep(time);
printf(".............\n");
printf("25岁,现实向你低了头!魅力+100,体质+100\n");
Sleep(time);
*meiLi += 100;
*tiZhi += 100;
printf(".............\n");
Sleep(time);
printf("100岁,你在极乐中死去!\n");
Sleep(time);
}
else if (*zhiHui + *tiZhi + *jiaJing + *meiLi <= 50 && *zhiHui>20)
{
printf("1岁,你很聪明!\n");
Sleep(time);
printf(".............\n");
Sleep(time);
printf("7岁,你刚从米开朗基罗大学博士毕业!智慧+100\n隔壁丫头有点喜欢你!\n");
Sleep(time);
*zhiHui += 100;
printf(".............\n");
Sleep(time);
printf("18岁,你凭借智慧赚了100亿,家境+666\n");
Sleep(time);
*zhiHui +=666;
printf(".............\n");
Sleep(time);
printf("20岁,你低调时有漂亮富婆想要包养你!体质+20\n");
Sleep(time);
*tiZhi += 20;
printf("21岁,你摊牌了,你包养了想要包养你的富婆!\n");
Sleep(time);
printf(".............\n");
Sleep(time);
printf("25岁,现实向你低了头!魅力+100,体质+100\n");
Sleep(time);
*meiLi += 100;
*tiZhi += 100;
printf(".............\n");
Sleep(time);
printf("100岁,你在极乐中死去!\n");
Sleep(time);
}
printf("1岁,你很普通!\n");
Sleep(time);
printf(".............\n");
Sleep(time);
printf("7岁,你有点普通!\n隔壁丫头有点讨厌你!\n");
Sleep(time);
printf(".............\n");
Sleep(time);
printf("18岁,你的成绩不是很理想,智慧-1\n");
*zhiHui -= 1;
Sleep(time);
printf(".............\n");
Sleep(time);
printf("20岁,没有富婆想要包养你!魅力-20,体质-20\n");
Sleep(time);
*meiLi -= 20;
*tiZhi -= 20;
printf(".............\n");
Sleep(time);
printf("25岁,你向现实低了头!魅力-30\n");
Sleep(time);
*meiLi -= 30;
printf(".............\n");
Sleep(time);
printf("77岁,你在不甘中死去!\n");
Sleep(time);
}
printf("统计中------\n");
Sleep(time);
printf("智力:%d 体质:%d 家境:%d 魅力:%d\n", *zhiHui, *tiZhi, *jiaJing, *meiLi);
Sleep(time);
printf("你最后的得分为:%d", (*zhiHui + *tiZhi + *jiaJing + *meiLi) / 20);
};
//游戏_过程
void youXi_guoCheng(int*zhiHui,int*tiZhi,int*jiaJing,int*meiLi)
{
printf("\n-----------------------");
printf("\n-------天赋列表--------\n");
tianFu(zhiHui, tiZhi, jiaJing, meiLi);
Sleep(time);
renSheng_liCheng(zhiHui, tiZhi, jiaJing, meiLi);
}
int main(){
int xuanze;
while (1){
int zhiHui = 0,tiZhi = 0,jiaJing = 0,meiLi = 0;
caiDan();
printf("请选择1或者2:\n");
scanf("%d", &xuanze);
switch (xuanze){
case 1:
printf("现在你有20点可以随机分配的初始属性!\n");
printf("-----------------------------------\n");
printf("请按照顺序分配属性\n");
printf("-----------------------------------\n");
printf("顺序为:智慧 体质 家境 魅力!\n");
scanf("%d%d%d%d",&zhiHui,&tiZhi,&jiaJing,&meiLi);
if (zhiHui + tiZhi + jiaJing + meiLi > 20)
{
printf("年轻人不要太贪婪!\n");
printf("贪婪的人会受到智商降为0的惩罚!\n");
zhiHui = 0;
printf("-----------------------\n");
printf("你现在的智力:%d", zhiHui);
}
youXi_guoCheng(&zhiHui,&tiZhi,&jiaJing,&meiLi);
break;
case 2:printf("游戏结束!");
exit(0);
break;
default:
printf("怎么输的,重输!");
break;
}
printf("\n");
printf("---------------------------------\n");
}
}
14.游戏盒子
#include<bits/stdc++.h>
#include <windows.h>
#include <stdio.h>
#include<conio.h>
#include<time.h>
using namespace std;
int x = 0;
int* X = &x;
char Void[10000] = "\0";
int Key = 0;
int KeyOut = 0;
int User;
int User2;
int* Q1;
int* Q2;
int* Q3;
int score; //游戏得分
const int nn = 809;
struct Point { int x, y; };
int dali;
int fx[4] = { -1,27,1,-27 };
int fxfx[4][2] = { {0,-1},{1,0},{0,1},{-1,0} };
int dis[1000][1000];
int changdi[30][27] = {
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{0,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1,0},
{0,1,0,0,0,0,1,0,0,0,0,0,1,0,1,0,0,0,0,0,1,0,0,0,0,1,0},
{0,1,0,0,0,0,1,0,0,0,0,0,1,0,1,0,0,0,0,0,1,0,0,0,0,1,0},
{0,1,0,0,0,0,1,0,0,0,0,0,1,0,1,0,0,0,0,0,1,0,0,0,0,1,0},
{0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0},
{0,1,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,1,0,0,1,0,0,0,0,1,0},
{0,1,1,1,1,1,1,0,0,1,1,1,1,0,1,1,1,1,0,0,1,1,1,1,1,1,0},
{0,0,0,0,0,0,1,0,0,0,0,0,2,0,2,0,0,0,0,0,1,0,0,0,0,0,0},
{0,0,0,0,0,0,1,0,0,0,0,0,2,0,2,0,0,0,0,0,1,0,0,0,0,0,0},
{0,0,0,0,0,0,1,0,0,2,2,2,2,2,2,2,2,2,0,0,1,0,0,0,0,0,0},
{0,0,0,0,0,0,1,0,0,2,0,0,0,3,0,0,0,2,0,0,1,0,0,0,0,0,0},
{0,0,0,0,0,0,1,0,0,2,0,3,3,3,3,3,0,2,0,0,1,0,0,0,0,0,0},
{2,2,2,2,2,2,1,2,2,2,0,3,3,3,3,3,0,2,2,2,1,2,2,2,2,2,2},
{0,0,0,0,0,0,1,0,0,2,0,3,3,3,3,3,0,2,0,0,1,0,0,0,0,0,0},
{0,0,0,0,0,0,1,0,0,2,0,0,0,0,0,0,0,2,0,0,1,0,0,0,0,0,0},
{0,0,0,0,0,0,1,0,0,2,2,2,2,2,2,2,2,2,0,0,1,0,0,0,0,0,0},
{0,0,0,0,0,0,1,0,0,2,0,0,0,0,0,0,0,2,0,0,1,0,0,0,0,0,0},
{0,0,0,0,0,0,1,0,0,2,0,0,0,0,0,0,0,2,0,0,1,0,0,0,0,0,0},
{0,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1,0},
{0,1,0,0,0,0,1,0,0,0,0,0,1,0,1,0,0,0,0,0,1,0,0,0,0,1,0},
{0,1,0,0,0,0,1,0,0,0,0,0,1,0,1,0,0,0,0,0,1,0,0,0,0,1,0},
{0,1,1,1,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,1,1,1,0},
{0,0,0,1,0,0,1,0,0,1,0,0,0,0,0,0,0,1,0,0,1,0,0,1,0,0,0},
{0,0,0,1,0,0,1,0,0,1,0,0,0,0,0,0,0,1,0,0,1,0,0,1,0,0,0},
{0,1,1,1,1,1,1,0,0,1,1,1,1,0,1,1,1,1,0,0,1,1,1,1,1,1,0},
{0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,1,0},
{0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,1,0},
{0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}
};
int xx, xx1, xx2, xx3, xx4, yy, yy5, yy2, yy3, yy4;
int now, now1, now2, now3, now4;
int gg1, gg2, gg3, gg4;
int fangx, nextfx, last1, last2, last3, last4;
int fenshu, guozi, guaitimer;
int T1, T2, t1, t2, stopped; //T:计时 t1:玩家速度 t2:怪物速度
int ff = 0; //f:{0:继续 1:被吃 2:赢了 3:输了}
int beichi;
#define high 20 //定义地图的高度
#define width 30 //定义地图的宽度
#define snake_maxlength 200 //蛇长最大值
int snake_x[snake_maxlength], snake_y[snake_maxlength]; //蛇的坐标
int snake_length; //蛇现在的长度
int Map[high][width] = { 0 }; //初始化地图,0表示空格,1表示蛇身,2表示食物,3表示墙,4表示蛇头,现在地图中什么也没有
int food_x, food_y; //食物的坐标
int SCORE; //本局分数
char input;
char primeinput = '.';
int op = 100;
int Death = 0;
int Guesstimes;
struct account{
char user[1000]; //用户名
char password[1000]; //密码
int coin = 0; //硬币
int number; //编号
int award = 0; //奖励次数,主要用于恋爱测试器奖励次数的限定
};
struct account peo[100]; //初设100人,可更改
void HideCursor()
{
CONSOLE_CURSOR_INFO cursor_info = { 1, 0 };
SetConsoleCursorInfo(GetStdHandle(STD_OUTPUT_HANDLE), &cursor_info);
}
float Check(int a)
{
if (a == 0) //针对字符和字符串
{
float m;
if (cin >> m)
{
return m;
}
else
{
cout << "输入错误,请重新输入:";
cin.clear(); //清除这个错误状态
cin.sync(); //清理缓冲区内容
cin.get();
while (!(cin >> m))
{
cout << "输入错误,请重新输入:";
cin.clear(); //清除这个错误状态
cin.sync(); //清理缓冲区内容
cin.get();
}
return m;
}
}
else if (a == 1){
float m;
float c;
if (cin >> m){
while (1){
if (m == 1 || m == 2 || m == 0){
return m;
break;
}
else{
cout << "输入错误,请重新输入:";
c = Check(1); //递归调用,重新检测输入
return c;
break;
}
}
}
else{
cout << "输入错误,请重新输入:";
cin.clear(); //清除这个错误状态
cin.sync(); //清理缓冲区内容
cin.get();
while (!(cin >> m)){
cout << "输入错误,请重新输入:";
cin.clear(); //清除这个错误状态
cin.sync(); //清理缓冲区内容
cin.get();
}
while (1){
if (m == 1 || m == 2 || m == 0){
return m;
break;
}
else{
cout << "输入错误,请重新输入:";
c = Check(1);
return c;
break;
}
}
}
}
else if (a == 2) //针对字符和字符串以及特定的数字(1、2)
{
float m;
float c;
if (cin >> m)
{
while (1)
{
if (m == 1 || m == 2)
{
return m;
break;
}
else
{
cout << "输入错误,请重新输入:";
c = Check(2);
return c;
break;
}
}
}
else
{
cout << "输入错误,请重新输入:";
cin.clear(); //清除这个错误状态
cin.sync();//清理缓冲区内容
cin.get();
while (!(cin >> m))
{
cout << "输入错误,请重新输入:";
cin.clear(); //清除这个错误状态
cin.sync(); //清理缓冲区内容
cin.get();
}
while (1)
{
if (m == 1 || m == 2)
{
return m;
break;
}
else
{
cout << "输入错误,请重新输入:";
a = Check(2);
return a;
break;
}
}
}
}
else if (a == 3) //针对字符和字符串以及特定的数字(1、2、3)
{
float m;
float c;
if (cin >> m)
{
while (1)
{
if (m == 1 || m == 2 || m == 3)
{
return m;
break;
}
else
{
cout << "输入错误,请重新输入:";
c = Check(3);
return c;
break;
}
}
}
else
{
cout << "输入错误,请重新输入:";
cin.clear(); //清除这个错误状态
cin.sync(); //清理缓冲区内容
cin.get();
while (!(cin >> m))
{
cout << "输入错误,请重新输入:";
cin.clear(); //清除这个错误状态
cin.sync(); //清理缓冲区内容
cin.get();
}
while (1){
if (m == 1 || m == 2 || m == 3){
return m;
break;
}
else{
cout << "输入错误,请重新输入:";
a = Check(3);
return a;
break;
}
}
}
}
else if (a == 4) { //针对字符和字符串以及特定的数字(1、0)
float m;
float c;
if (cin >> m){
while (1){
if (m == 1 || m == 0){
return m;
break;
}
else{
cout << "输入错误,请重新输入:";
c = Check(4);
return c;
break;
}
}
}
else{
cout << "输入错误,请重新输入:";
cin.clear(); //清除这个错误状态
cin.sync(); //清理缓冲区内容
cin.get();
while (!(cin >> m)){
cout << "输入错误,请重新输入:";
cin.clear(); //清除这个错误状态
cin.sync(); //清理缓冲区内容
cin.get();
}
while (1){
if (m == 1 || m == 0){
return m;
break;
}
else
{
cout << "输入错误,请重新输入:";
a = Check(4);
return a;
break;
}
}
}
}
}
void Progress(){
int c = 1, d = 0;
for (int i = 0; i < 50; i++)
{
cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
cout << "\t\t\t\t+-------------------------------------------------+" << endl;
cout << "\t\t\t\t|";
for (int a = 0; a < i; a++) //打印▋
{
cout << "▋";
}
for (int b = 49 - i; b > 0; b--) //打印空格
{
cout << " ";
}
d += 2; //进度数
cout << "| " << d << "%" << endl;
cout << "\t\t\t\t+-------------------------------------------------+" << endl;
cout << "\t\t\t\t 正在加载中,请稍后.";
for (int j = 0; j < c % 6; j++)
{
cout << ".";
}
c++;
cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
Sleep(150); //进度条读取速度
if (i != 49)
{
system("cls"); //清屏
}
}
Sleep(3000);
system("cls");
}
int NormalizeName(char name[1000], int n)
{
int a = 0; //计数器
if (n <= 15)
{
for (int i = 0; i < n; i++)
{
if (name[i] <= 32 || name[i] == 127) //为空格或其他特殊情况
{
break;
}
else
{
a++;
}
}
if (a == n)
{
return 1;
}
else
{
return 0;
}
}
else
{
return 0;
}
}
//--------------------------------------------------------------------------------------------------------------
// 用户名查重系统
int CheckName(char name[1000])
{
int a = 0; //计数器
if (x == 0) //第一个注册的人无重复
{
return 1;
}
else
{
for (int i = 0; i < x; i++)
{
if (strcmp(name, peo[i].user) == 0)
{
break;
}
else
{
a++;
}
}
if (a == x) //用户名无重复
{
return 1;
}
else
{
return 0;
}
}
}
//--------------------------------------------------------------------------------------------------------------
// 密码规范系统
int NormalizePassword(char password[1000], int n)
{
int a = 0; //计数器
if (n >= 6 && n <= 15)
{
for (int i = 0; i < n; i++)
{
if ((password[i] >= 48 && password[i] <= 57) || (password[i] >= 65 && password[i] <= 90) || (password[i] >= 97 && password[i] <= 122)) //为字母或数字
{
a++;
}
else
{
break;
}
}
if (a == n)
{
return 1;
}
else
{
return 0;
}
}
else
{
return 0;
}
}
//--------------------------------------------------------------------------------------------------------------
// 密码找回系统
int RefoundPassword()
{
while (1)
{
char Name2[1000];
int Key1 = 0;
cout << "请输入用户名:";
cin >> Name2;
for (int i = 0; i < *X; i++) //逐个人员遍历
{
if (strcmp(Name2, peo[i].user) == 0) //判断输入的用户名有无注册或是否正确
{
Key1 = 1;
User2 = i;
}
}
system("cls"); //清屏
if (Key1 == 0) //钥匙解锁失败
{
cout << "您的用户名未注册或输入错误!!!" << endl << endl;
cout << "1.继续找回密码" << endl;
cout << "2.退出系统" << endl;
cout << "请输入数字实现对应功能:";
int m2 = Check(2); //只返回1、2
cout << endl;
if (m2 == 1)
{
system("cls"); //清屏
continue;
}
else if (m2 == 2)
{
system("cls"); //清屏
return 0;
}
}
else if (Key1 == 1) //钥匙解锁成功
{
cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
cout << "\t\t\t\t\t\t 您的密码为:" << peo[User2].password << endl;
Sleep(2000);
system("pause");
system("cls"); //清屏
return 1;
}
}
}
//--------------------------------------------------------------------------------------------------------------
// 账号注册系统:
int Register()
{
int key1 = 0; //注册成功的钥匙
int key2 = 0; //用户名设置成功的钥匙
int key3 = 0; //密码设置成功钥匙
int key4 = 0; //退出程序的钥匙
int h = 0; //轮转片
char recheck[100];
peo[x].number = x + 1; //标号
while (1) //创建用户名
{
cout << "请设置用户名(不超过15个字符,空格与汉字为非法字符):";
cin.get(); //cin.getline前要吸收回车键
cin.getline(peo[x].user, 1000);
int n1 = strlen(peo[x].user);
int p1 = NormalizeName(peo[x].user, n1); //返回1用户名通过,返回0则不通过
int p2 = CheckName(peo[x].user); //返回1用户名通过,返回0则不通过
if (p1 == 1 && p2 == 1)
{
key2 = 1; //钥匙开锁,用户名设置成功
break;
}
else
{
cout << endl << endl;
cout << "用户名重复或非法!!!" << endl;
cout << "1.重新设置用户名" << endl;
cout << "2.退出注册" << endl;
cout << "请输入数字实现对应功能:";
int q = Check(2); //只返回1、2
cout << endl;
if (q == 1) //重新设置用户名
{
strcpy(peo[x].user, Void); //清空输入的用户名
system("cls"); //清屏
continue;
}
else if (q == 2) //退出注册
{
system("cls"); //清屏
break;
}
}
}
cout << endl << endl;
if (key2 == 1)
{
while (1) //设置密码
{
system("cls"); //清屏
cout << "请设置密码(只能为字母和数字,长度不小于6,不超过15):";
if (h != 0)
{
cin.get(); //cin.getline前要吸收回车键
}
cin.getline(peo[x].password, 1000);
//cout << peo[x].password << endl;
int n2 = strlen(peo[x].password);
int p3 = NormalizePassword(peo[x].password, n2); //返回1密码通过,返回0则不通过
if (p3 == 1)
{
key3 = 1; //钥匙开锁,密码设置成功
}
else
{
cout << endl << endl;
cout << "密码非法!!!" << endl;
cout << "1.重新设置密码" << endl;
cout << "2.退出注册" << endl;
cout << "请输入数字实现对应功能:";
int q = Check(2); //只返回1、2
cout << endl;
if (q == 1) //重新设置密码
{
strcpy(peo[x].password, Void); //清空输入的密码
cout << endl << endl;
h++;
continue;
}
else if (q == 2) //退出注册
{
system("cls"); //清屏
break;
}
}
if (key3 == 1)
{
system("cls"); //清屏
while (1)
{
cout << "请再次输入密码:";
cin >> recheck;
//cout << recheck << endl;
if (strcmp(recheck, peo[x].password) == 0)
{
cout << endl;
cout << "注册成功!!!" << endl << endl;
(*X)++;
key1 = 1; //钥匙开锁,注册成功
key4 = 1; //钥匙开锁,退出设置用户名和密码的程序
break;
}
else
{
cout << endl;
cout << "两次密码不一致!!!" << endl;
cout << "1.重新设置密码" << endl;
cout << "2.退出注册" << endl;
cout << "请输入数字实现对应功能:";
int z = Check(2); //只返回1、2
cout << endl;
if (z == 1)
{
strcpy(recheck, Void); //清空输入的密码
strcpy(peo[x].password, Void); //清空输入的密码
key3 = 0; //关锁
h++;
break;
}
else if (z == 2)
{
system("cls"); //清屏
key4 = 1; //钥匙开锁,退出设置用户名和密码的程序
break;
}
}
}
}
if (key4 == 1)
{
break;
}
}
}
if (key1 == 1)
{
cout << "是否直接进入程序?" << endl;
cout << "1.是" << endl;
cout << "2.否" << endl;
cout << "请输入数字实现对应功能:";
int m = Check(2); //只返回1、2
cout << endl;
if (m == 1)
{
User = x - 1;
return m;
}
else if (m == 2)
{
return m;
}
}
}
//--------------------------------------------------------------------------------------------------------------
// 账号登录系统
int SignIn()
{
char Name[1000], Password[1000];
int Key1 = 0; //判断用户名正误的钥匙
int Key2 = 0; //判断密码正误的钥匙
while (1)
{
cout << "请输入用户名:"; //有BUG
cin >> Name;
for (int i = 0; i < *X; i++) //逐个人员遍历
{
if (strcmp(Name, peo[i].user) == 0) //判断输入的用户名有无注册或是否正确
{
Key1 = 1;
User = i;
}
}
if (Key1 == 0) //钥匙解锁失败
{
cout << "您的用户名未注册或输入错误!!!" << endl << endl;
cout << "1.继续登录" << endl;
cout << "2.退出登录" << endl;
cout << "请输入数字实现对应功能:";
int m1 = Check(2); //只返回1、2
cout << endl;
if (m1 == 1)
{
system("cls"); //清屏
continue;
}
else if (m1 == 2)
{
system("cls"); //清屏
return 0;
}
}
else if (Key1 == 1) //钥匙解锁成功
{
cout << "请输入密码:";
cin >> Password;
if (strcmp(Password, peo[User].password) == 0) //判断输入的密码是否正确
{
Key2 = 1; //钥匙开锁,成功登陆
}
if (Key2 == 0) //密码错误
{
cout << endl << "您输入的密码有误" << endl;
cout << "1.重新登录" << endl;
cout << "2.找回密码" << endl;
cout << "3.退出登录" << endl;
cout << "请输入数字实现对应功能:";
int m2 = Check(3); //只返回1、2、3
cout << endl;
if (m2 == 1)
{
Key1 = 0; //重新登陆关锁
system("cls"); //清屏
continue;
}
else if (m2 == 2)
{
Key1 = 0; //重新登陆关锁
system("cls"); //清屏
int r = RefoundPassword();
if (r == 1)
{
cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
cout << "\t\t\t\t\t\t 密码找回成功!!!" << endl;
Sleep(2000);
system("cls"); //清屏
continue;
}
else if (r == 0)
{
cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
cout << "\t\t\t\t\t\t 密码找回失败!!!" << endl;
Sleep(2000);
system("cls"); //清屏
continue;
}
}
else if (m2 == 3)
{
system("cls"); //清屏
return 0;
}
}
else if (Key2 == 1) //密码正确
{
system("cls"); //清屏
cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
cout << "\t\t\t\t\t\t 登录成功!!!" << endl;
Sleep(2000); //延时2秒
return 1;
}
}
}
}
//--------------------------------------------------------------------------------------------------------------
// 游戏部分
//1.雷霆战机
/*=============== all the structures ===============*/
typedef struct Frame
{
COORD position[2];
int flag;
}Frame;
/*=============== all the functions ===============*/
void SetPos(COORD a)// set cursor
{
HANDLE out = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleCursorPosition(out, a);
}
void SetPos(int i, int j)// set cursor
{
COORD pos = { i, j };
SetPos(pos);
}
//把第y行,[x1, x2) 之间的坐标填充为 ch
void drawRow(int y, int x1, int x2, char ch)
{
SetPos(x1, y);
for (int i = 0; i <= (x2 - x1); i++)
cout << ch;
}
//在a, b 纵坐标相同的前提下,把坐标 [a, b] 之间填充为 ch
void drawRow(COORD a, COORD b, char ch)
{
if (a.Y == b.Y)
drawRow(a.Y, a.X, b.X, ch);
else
{
SetPos(0, 25);
cout << "error code 01:无法填充行,因为两个坐标的纵坐标(x)不相等";
system("pause");
}
}
//把第x列,[y1, y2] 之间的坐标填充为 ch
void drawCol(int x, int y1, int y2, char ch)
{
int y = y1;
while (y != y2 + 1)
{
SetPos(x, y);
cout << ch;
y++;
}
}
//在a, b 横坐标相同的前提下,把坐标 [a, b] 之间填充为 ch
void drawCol(COORD a, COORD b, char ch)
{
if (a.X == b.X)
drawCol(a.X, a.Y, b.Y, ch);
else
{
SetPos(0, 25);
cout << "error code 02:无法填充列,因为两个坐标的横坐标(y)不相等";
system("pause");
}
}
//左上角坐标、右下角坐标、用row填充行、用col填充列
void drawFrame(COORD a, COORD b, char row, char col)
{
drawRow(a.Y, a.X + 1, b.X - 1, row);
drawRow(b.Y, a.X + 1, b.X - 1, row);
drawCol(a.X, a.Y + 1, b.Y - 1, col);
drawCol(b.X, a.Y + 1, b.Y - 1, col);
}
void drawFrame(int x1, int y1, int x2, int y2, char row, char col)
{
COORD a = { x1, y1 };
COORD b = { x2, y2 };
drawFrame(a, b, row, col);
}
void drawFrame(Frame frame, char row, char col)
{
COORD a = frame.position[0];
COORD b = frame.position[1];
drawFrame(a, b, row, col);
}
void drawPlaying()
{
drawFrame(0, 0, 48, 24, '=', '|');// draw Map frame;
drawFrame(49, 0, 79, 4, '-', '|');// draw output frame
drawFrame(49, 4, 79, 9, '-', '|');// draw score frame
drawFrame(49, 9, 79, 20, '-', '|');// draw operate frame
drawFrame(49, 20, 79, 24, '-', '|');// draw other message frame
SetPos(52, 6);
cout << "得分:";
SetPos(52, 7);
cout << "称号:";
SetPos(52, 10);
cout << "操作方式:";
SetPos(52, 12);
cout << " a,s,d,w 控制移动,j开炮";
SetPos(52, 14);
cout << " p 暂停游戏";
SetPos(52, 16);
cout << " e 退出游戏";
}
//在[a, b)之间产生一个随机整数
int random(int a, int b)
{
int c = (rand() % (a - b)) + a;
return c;
}
//在两个坐标包括的矩形框内随机产生一个坐标
COORD random(COORD a, COORD b)
{
int x = random(a.X, b.X);
int y = random(a.Y, b.Y);
COORD c = { x, y };
return c;
}
bool judgeCoordInFrame(Frame frame, COORD spot)
{
if (spot.X >= frame.position[0].X)
if (spot.X <= frame.position[1].X)
if (spot.Y >= frame.position[0].Y)
if (spot.Y <= frame.position[0].Y)
return true;
return false;
}
void printCoord(COORD a)
{
cout << "( " << a.X << " , " << a.Y << " )";
}
void printFrameCoord(Frame a)
{
printCoord(a.position[0]);
cout << " - ";
printCoord(a.position[1]);
}
int drawMenu()
{
SetPos(30, 1);
cout << "P l a n e W a r";
drawRow(3, 0, 79, '-');
drawRow(5, 0, 79, '-');
SetPos(28, 4);
cout << "w 和 s 选择, j 确定";
SetPos(15, 11);
cout << "1. 简单的敌人";
SetPos(15, 13);
cout << "2. 冷酷的敌人";
drawRow(20, 0, 79, '-');
drawRow(22, 0, 79, '-');
SetPos(47, 11);
cout << "简单的敌人:";
SetPos(51, 13);
cout << "简单敌人有着较慢的移动速度。";
SetPos(24, 21);
cout << "说明:得分超过200即为胜利";
int j = 11;
SetPos(12, j);
cout << ">>";
while (1)
{
if (_kbhit())
{
char x = _getch();
switch (x)
{
case 'w':
{
if (j == 13)
{
SetPos(12, j);
cout << " ";
j = 11;
SetPos(12, j);
cout << ">>";
SetPos(51, 13);
cout << " ";
SetPos(47, 11);
cout << "简单的敌人:";
SetPos(51, 13);
cout << "简单敌人有较慢的移动速度,比较容易对付";
}
break;
}
case 's':
{
if (j == 11)
{
SetPos(12, j);
cout << " ";
j = 13;
SetPos(12, j);
cout << ">>";
SetPos(51, 13);
cout << " ";
SetPos(47, 11);
cout << "冷酷的敌人:";
SetPos(51, 13);
cout << "冷酷的敌人移动速度较快,不是很好对付哟。";
}
break;
}
case 'j':
{
if (j == 8) return 1;
else return 2;
}
}
}
}
}
/*================== the Game Class ==================*/
class Game
{
public:
COORD position[10];
COORD bullet[10];
Frame enemy[8];
int rank;
int rankf;
string title;
int flag_rank;
Game();
//初始化所有
void initPlane();
void initBullet();
void initEnemy();
//初始化其中一个
//void initThisBullet( COORD );
//void initThisEnemy( Frame );
void planeMove(char);
void bulletMove();
void enemyMove();
void drawPlane();
void drawPlaneToNull();
void drawBullet();
void drawBulletToNull();
void drawEnemy();
void drawEnemyToNull();
void drawThisBulletToNull(COORD);
void drawThisEnemyToNull(Frame);
void Pause();
void Playing();
int judgePlane();
void judgeEnemy();
void Shoot();
void GameOver();
void printScore();
};
Game::Game()
{
initPlane();
initBullet();
initEnemy();
score = 0;
rank = 25;
rankf = 0;
flag_rank = 0;
}
void Game::initPlane()
{
COORD centren = { 39, 22 };
position[0].X = position[5].X = position[7].X = position[9].X = centren.X;
position[1].X = centren.X - 2;
position[2].X = position[6].X = centren.X - 1;
position[3].X = position[8].X = centren.X + 1;
position[4].X = centren.X + 2;
for (int i = 0; i <= 4; i++)
position[i].Y = centren.Y;
for (int i = 6; i <= 8; i++)
position[i].Y = centren.Y + 1;
position[5].Y = centren.Y - 1;
position[9].Y = centren.Y - 2;
}
void Game::drawPlane()
{
for (int i = 0; i < 9; i++)
{
SetPos(position[i]);
if (i != 5)
cout << "O";
else if (i == 5)
cout << "|";
}
}
void Game::drawPlaneToNull()
{
for (int i = 0; i < 9; i++)
{
SetPos(position[i]);
cout << " ";
}
}
void Game::initBullet()
{
for (int i = 0; i < 10; i++)
bullet[i].Y = 30;
}
void Game::drawBullet()
{
for (int i = 0; i < 10; i++)
{
if (bullet[i].Y != 30)
{
SetPos(bullet[i]);
cout << "^";
}
}
}
void Game::drawBulletToNull()
{
for (int i = 0; i < 10; i++)
if (bullet[i].Y != 30)
{
COORD pos = { bullet[i].X, bullet[i].Y + 1 };
SetPos(pos);
cout << " ";
}
}
void Game::initEnemy()
{
COORD a = { 1, 1 };
COORD b = { 45, 15 };
for (int i = 0; i < 8; i++)
{
enemy[i].position[0] = random(a, b);
enemy[i].position[1].X = enemy[i].position[0].X + 3;
enemy[i].position[1].Y = enemy[i].position[0].Y + 2;
}
}
void Game::drawEnemy()
{
for (int i = 0; i < 8; i++)
drawFrame(enemy[i].position[0], enemy[i].position[1], '-', '|');
}
void Game::drawEnemyToNull()
{
for (int i = 0; i < 8; i++)
{
drawFrame(enemy[i].position[0], enemy[i].position[1], ' ', ' ');
}
}
void Game::Pause()
{
SetPos(61, 2);
cout << " ";
SetPos(61, 2);
cout << "暂停中...";
char c = _getch();
while (c != 'p')
c = _getch();
SetPos(61, 2);
cout << " ";
}
void Game::planeMove(char x)
{
if (x == 'a')
if (position[1].X != 1)
for (int i = 0; i <= 9; i++)
position[i].X -= 2;
if (x == 's')
if (position[7].Y != 23)
for (int i = 0; i <= 9; i++)
position[i].Y += 1;
if (x == 'd')
if (position[4].X != 47)
for (int i = 0; i <= 9; i++)
position[i].X += 2;
if (x == 'w')
if (position[5].Y != 3)
for (int i = 0; i <= 9; i++)
position[i].Y -= 1;
}
void Game::bulletMove()
{
for (int i = 0; i < 10; i++)
{
if (bullet[i].Y != 30)
{
bullet[i].Y -= 1;
if (bullet[i].Y == 1)
{
COORD pos = { bullet[i].X, bullet[i].Y + 1 };
drawThisBulletToNull(pos);
bullet[i].Y = 30;
}
}
}
}
void Game::enemyMove()
{
for (int i = 0; i < 8; i++)
{
for (int j = 0; j < 2; j++)
enemy[i].position[j].Y++;
if (24 == enemy[i].position[1].Y)
{
COORD a = { 1, 1 };
COORD b = { 45, 3 };
enemy[i].position[0] = random(a, b);
enemy[i].position[1].X = enemy[i].position[0].X + 3;
enemy[i].position[1].Y = enemy[i].position[0].Y + 2;
}
}
}
int Game::judgePlane()
{
for (int i = 0; i < 8; i++)
{
for (int j = 0; j < 9; j++)
{
if (judgeCoordInFrame(enemy[i], position[j]))
{
SetPos(62, 1);
cout << "坠毁";
drawFrame(enemy[i], '+', '+');
Sleep(1000);
GameOver();
return 1;
}
}
}
}
void Game::drawThisBulletToNull(COORD c)
{
SetPos(c);
cout << " ";
}
void Game::drawThisEnemyToNull(Frame f)
{
drawFrame(f, ' ', ' ');
}
void Game::judgeEnemy()
{
for (int i = 0; i < 8; i++)
for (int j = 0; j < 10; j++)
if (judgeCoordInFrame(enemy[i], bullet[j]))
{
score += 5;
drawThisEnemyToNull(enemy[i]);
COORD a = { 1, 1 };
COORD b = { 45, 3 };
enemy[i].position[0] = random(a, b);
enemy[i].position[1].X = enemy[i].position[0].X + 3;
enemy[i].position[1].Y = enemy[i].position[0].Y + 2;
drawThisBulletToNull(bullet[j]);
bullet[j].Y = 30;
}
}
void Game::Shoot()
{
for (int i = 0; i < 10; i++)
if (bullet[i].Y == 30)
{
bullet[i].X = position[5].X;
bullet[i].Y = position[5].Y - 1;
break;
}
}
void Game::printScore()
{
if (score == 30 && flag_rank == 0)
{
rank -= 3;
flag_rank = 1;
}
else if (score == 70 && flag_rank == 1)
{
rank -= 5;
flag_rank = 2;
}
else if (score == 110 && flag_rank == 2)
{
rank -= 5;
flag_rank = 3;
}
int x = rank / 5;
SetPos(60, 6);
cout << score;
if (rank != rankf)
{
SetPos(60, 7);
if (x == 5)
title = "初级飞行员";
else if (x == 4)
title = "中级飞行员";
else if (x == 3)
title = "高级飞行员";
else if (x == 2)
title = "王牌飞行员";
cout << title;
}
rankf = rank;
}
void Game::Playing(){
drawEnemy();
drawPlane();
int flag_bullet = 0;
int flag_enemy = 0;
while (1)
{
Sleep(8);
if (_kbhit()){
char x = _getch();
if ('a' == x || 's' == x || 'd' == x || 'w' == x){
drawPlaneToNull();
planeMove(x);
drawPlane();
int ggg = judgePlane();
if (ggg == 1) return;
}
else if ('p' == x) //暂停
Pause();
else if ('j' == x) //开炮
Shoot();
else if ('e' == x)
{
break;
}
}
if (0 == flag_bullet)
{
bulletMove();
drawBulletToNull();
drawBullet();
judgeEnemy();
}
flag_bullet++;
if (5 == flag_bullet)
flag_bullet = 0;
if (0 == flag_enemy)
{
drawEnemyToNull();
enemyMove();
drawEnemy();
int gggg = judgePlane();
if (gggg == 1)
{
return;
}
}
flag_enemy++;
if (flag_enemy >= rank)
flag_enemy = 0;
printScore();
}
return;
}
void Game::GameOver()
{
system("cls");
COORD p1 = { 28,9 };
COORD p2 = { 53,15 };
drawFrame(p1, p2, '=', '|');
SetPos(36, 12);
string str = "Game Over!";
for (int i = 0; i < str.size(); i++)
{
Sleep(80);
cout << str[i];
}
Sleep(1000);
system("cls");
drawFrame(p1, p2, '=', '|');
SetPos(31, 11);
cout << "击落敌机:" << score / 5 << " 架";
SetPos(31, 12);
cout << "得 分:" << score;
SetPos(31, 13);
cout << "获得称号:" << title;
Sleep(3000);
return;
}
void PlaneWar()
{
cout << "*********************************************** 雷 霆 战 机 *************************************************" << endl;
cout << " 游戏说明:" << endl;
cout << " ① 玩家通过按键w、s、a、d进行战机的移动,a为向左移动,s为向下移动,d为向右移动,w为向上移动,通过按键j进行开炮操作;" << endl;
cout << " ② 玩家需要躲避敌方战机,若有碰撞,则您的战机坠毁,游戏结束;" << endl;
cout << " ③ 玩家通过开炮可击落敌方战机,每击落一架战机,可获得5分;" << endl;
cout << " ④ 游戏得分超过200分即为游戏胜利,将获得30枚硬币的奖励,否则即为失败。" << endl << endl << endl;
Sleep(3000);
system("pause");
system("cls");
srand((int)time(0)); //随机种子
Game game;
int a = drawMenu();
if (a == 2)
game.rank = 20;
system("cls");
drawPlaying();
game.Playing(); //开始游戏
Q1 = &score;
return;
}
void color(int a)//颜色函数
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), a);
}
void gotoxy(int x, int y)//位置函数(行为x 列为y)
{
COORD pos;
pos.X = 2 * y;
pos.Y = x;
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), pos);
}
void begin() {
system("cls");
color(11); cout << " ★";
color(10); cout << "吃豆人";
color(11); cout << "★\n\n";
color(7);
cout << " 请将窗口开至";
color(11); cout << "全屏" << endl;
color(7); cout << " 正在初始化,请耐心等待";
for (int i = 0; i <= nn; i++)
for (int j = 1; j <= nn; j++)
dis[i][j] = 900;
for (int i = 0; i <= nn; i++) {
for (int j = 0; j <= 3; j++) {
if (i + fx[j] >= 0 && i + fx[j] <= nn) {
int k = i + fx[j], xx = k / 27, yy = k % 27, kk;
if (changdi[i / 27][i % 27] && changdi[xx][yy]) dis[i][k] = kk = 1;
}
}
}
for (int k = 0; k <= nn; k++)if (changdi[k]) {
for (int i = 0; i <= nn; i++)if (changdi[i])
for (int j = 0; j <= nn; j++)if (changdi[j])
if (dis[i][j] > dis[i][k] + dis[k][j])
dis[i][j] = dis[i][k] + dis[k][j];
if (k % 80 == 0) { color(13); gotoxy(3, 12); cout << "│"; }
if (k % 80 == 20) { color(13); gotoxy(3, 12); cout << "╱"; }
if (k % 80 == 40) { color(13); gotoxy(3, 12); cout << "─"; }
if (k % 80 == 60) { color(13); gotoxy(3, 12); cout << "╲"; }
if (k % 60 == 0) { color(11); gotoxy(5, k / 60); cout << "●"; }
}
cout << "游戏操作如下:";
}
void shuru() {
char ch;
cout << "请在输入完成后点击回车";
cin >> ch;
if ((ch == '1') | (ch == 'j'))
if ((changdi[xx + fxfx[0][0]][yy + fxfx[0][1]] == 1) | (changdi[xx + fxfx[0][0]][yy + fxfx[0][1]] == 2)) fangx = nextfx = 0;
else nextfx = 0;
else if ((ch == '2') | (ch == 'k'))
if ((changdi[xx + fxfx[1][0]][yy + fxfx[1][1]] == 1) | (changdi[xx + fxfx[1][0]][yy + fxfx[1][1]] == 2)) fangx = nextfx = 1;
else nextfx = 1;
else if ((ch == '3') | (ch == 'l'))
if ((changdi[xx + fxfx[2][0]][yy + fxfx[2][1]] == 1) | (changdi[xx + fxfx[2][0]][yy + fxfx[2][1]] == 2)) fangx = nextfx = 2;
else nextfx = 2;
else if ((ch == '5') | (ch == 'i'))
if ((changdi[xx + fxfx[3][0]][yy + fxfx[3][1]] == 1) | (changdi[xx + fxfx[3][0]][yy + fxfx[3][1]] == 2)) fangx = nextfx = 3;
else nextfx = 3;
else if ((ch == '0') | (ch == 's')) stopped = (stopped + 1) % 2;
else if ((ch == '4') | (ch == 'a')) t1++;
else if ((ch == '7') | (ch == 'q')) t2++;
else if (((ch == '6') | (ch == 'd')) && t1 - 1 > 0) t1--;
else if (((ch == '9') | (ch == 'e')) && t2 - 1 > 0) t2--;
else if (ch == 'g') dali = (dali + 1) % 2;
}
void reset() {
system("cls"); color(7);
gotoxy(2, 30); cout << "控制方向:I/J/K/L";
gotoxy(4, 30); cout << "你的速度:4/6";
gotoxy(6, 30); cout << "怪物速度:7/9";
xx = 22; yy = 13;
xx1 = xx2 = xx3 = xx4 = 14;
yy5 = 11; yy2 = 12; yy3 = 14; yy4 = 15;
now = 607; now1 = 389; now2 = 390; now3 = 392; now4 = 393;
for (int k = 0; k <= nn; k++) {
int i = k / 27, j = k % 27;
gotoxy(i, j);
if (changdi[i][j] == 1) { color(7); cout << "·"; }
else if (!changdi[i][j]) { color(1); cout << "■"; }
if (j == 26) { gotoxy(i, 27); color(7); cout << i; }
}
gotoxy(0, 0);
gotoxy(xx, yy); color(14); cout << "●";
gotoxy(xx1, yy5); color(4); cout << "◆";
gotoxy(xx2, yy2); color(5); cout << "◆";
gotoxy(xx3, yy3); color(3); cout << "◆";
gotoxy(xx4, yy4); color(2); cout << "◆";
fangx = 0; T1 = T2 = guaitimer = 0; t1 = 75; t2 = 100;
stopped = 0; fenshu = 0; guozi = 237;
gg1 = gg2 = gg3 = gg4 = 0; dali = 0;
gotoxy(14, 30);
cout << " ";
}
void move1() {
int xxx, yyy;
xxx = xx + fxfx[nextfx][0]; yyy = yy + fxfx[nextfx][1];
if (changdi[xxx][yyy]) {
if (changdi[xxx][yyy] == 1) { fenshu += 1; changdi[xxx][yyy] = 2; }
color(14);
gotoxy(xx, yy); printf(" ");
gotoxy(xxx, yyy); if (!dali) printf("◎"); else printf("☆");
now = xx * 27 + yy; xx = xxx; yy = yyy;
fangx = nextfx;
}
else {
if (xx == 13 && yy == 0 && fangx == 0) { xxx = xx; yyy = 26; }
else if (xx == 13 && yy == 26 && fangx == 2) { xxx = xx; yyy = 0; }
else { xxx = xx + fxfx[fangx][0]; yyy = yy + fxfx[fangx][1]; }
if (changdi[xxx][yyy]) {
if (changdi[xxx][yyy] == 1) { fenshu += 1; changdi[xxx][yyy] = 2; }
color(14);
gotoxy(xx, yy); cout << " ";
gotoxy(xxx, yyy);
if (!dali) cout << "◎";
else cout << "☆";
now = xx * 27 + yy; xx = xxx; yy = yyy;
}
}
color(7);
}
void move2() {
int haha, minhaha, xxx, yyy, chi = 0;
if (gg1) {
minhaha = 2147483647;
if ((now1 % 27 == 0) | (now1 % 27 == 26)) haha = last1;
else if (!dali) {
for (int i = 0; i <= 3; i++)
if (changdi[(now1 + fx[i]) / 27][(now1 + fx[i]) % 27] && i != last1 && minhaha > dis[now1 + fx[i]][now])
{
minhaha = dis[now1 + fx[i]][now]; haha = i;
}
}
else {
minhaha = -minhaha;
for (int i = 0; i <= 3; i++)
if (changdi[(now1 + fx[i]) / 27][(now1 + fx[i]) % 27] && i != last1 && minhaha < dis[now1 + fx[i]][now])
{
minhaha = dis[now1 + fx[i]][now]; haha = i;
}
}
xxx = now1 / 27; yyy = now1 % 27; gotoxy(xxx, yyy);
if (changdi[xxx][yyy] == 1) cout << "·";
else cout << " ";
now1 += fx[haha]; last1 = (haha + 2) % 4;
xxx = now1 / 27; yyy = now1 % 27; gotoxy(xxx, yyy);
color(4); cout << "◆";
color(7);
if (xxx == xx && yyy == yy) {
if (!dali) chi += 1;
else {
guozi += 50;
fenshu += 50;
last1 = 0;
gotoxy(now1 / 27, now1 % 27);
if (changdi[now1 / 27][now1 % 27] == 1) printf("·"); else printf(" ");
now1 = 389;
}
}
}
if (gg2) {
int k;
minhaha = 2147483647;
if ((fangx == 0) | (fangx == 2)) {
k = yy + (fxfx[fangx][1]) * 3;
while ((k > 25) | !changdi[xx][k]) k--;
while ((k < 1) | !changdi[xx][k]) k++;
}
else {
k = xx + (fxfx[fangx][0]) * 3;
while ((k > 28) | !changdi[k][yy]) k--;
while ((k < 1) | !changdi[k][yy]) k++;
}
if ((fangx == 0) | (fangx == 2)) k = xx * 27 + k; else k = k * 27 + yy;
if ((now2 % 27 == 0) | (now2 % 27 == 26)) haha = last2;
else if (!dali)
for (int i = 0; i <= 3; i++) {
if (changdi[(now2 + fx[i]) / 27][(now2 + fx[i]) % 27] && i != last2 && minhaha > dis[now2 + fx[i]][k])
{
minhaha = dis[now2 + fx[i]][k]; haha = i;
}
}
else {
minhaha = -minhaha;
for (int i = 0; i <= 3; i++) {
if (changdi[(now2 + fx[i]) / 27][(now2 + fx[i]) % 27] && i != last2 && minhaha < dis[now2 + fx[i]][k])
{
minhaha = dis[now2 + fx[i]][k]; haha = i;
}
}
}
xxx = now2 / 27; yyy = now2 % 27; gotoxy(xxx, yyy);
if (changdi[xxx][yyy] == 1) cout << "·";
else cout << " ";
now2 += fx[haha]; last2 = (haha + 2) % 4; gotoxy(18, 30);
xxx = now2 / 27; yyy = now2 % 27; gotoxy(xxx, yyy); color(5); cout << "◆";
color(7);
if (xxx == xx && yyy == yy) {
if (!dali) chi += 1;
else {
guozi += 50;
fenshu += 50;
last2 = 0;
gotoxy(now2 / 27, now2 % 27);
if (changdi[now2 / 27][now2 % 27] == 1) cout << "·"; else cout << " ";
now2 = 390;
}
}
}
if (gg3) {
int k;
minhaha = 2147483647;
if ((fangx == 0) | (fangx == 2)) {
k = yy + (fxfx[(fangx + 1) % 4][1]) * 3;
while ((k > 25) | !changdi[xx][k]) k--;
while ((k < 1) | !changdi[xx][k]) k++;
}
else {
k = xx + (fxfx[(fangx + 1) % 4][0]) * 3;
while ((k > 28) | !changdi[k][yy]) k--;
while ((k < 1) | !changdi[k][yy]) k++;
}
if ((fangx == 0) | (fangx == 2)) k = xx * 27 + k; else k = k * 27 + yy;
if ((now3 % 27 == 0) | (now3 % 27 == 26)) haha = last3;
else if (!dali)
for (int i = 0; i <= 3; i++) {
if (changdi[(now3 + fx[i]) / 27][(now3 + fx[i]) % 27] && i != last3 && minhaha > dis[now3 + fx[i]][k])
{
minhaha = dis[now3 + fx[i]][k]; haha = i;
}
}
else {
minhaha = -minhaha;
for (int i = 0; i <= 3; i++) {
if (changdi[(now3 + fx[i]) / 27][(now3 + fx[i]) % 27] && i != last3 && minhaha < dis[now3 + fx[i]][k])
{
minhaha = dis[now3 + fx[i]][k]; haha = i;
}
}
}
xxx = now3 / 27; yyy = now3 % 27; gotoxy(xxx, yyy);
if (changdi[xxx][yyy] == 1) cout << "·"; else cout << " ";
now3 += fx[haha]; last3 = (haha + 2) % 4; gotoxy(18, 30);
xxx = now3 / 27; yyy = now3 % 27;
gotoxy(xxx, yyy); color(3); cout << "◆";
color(7);
if (xxx == xx && yyy == yy) {
if (!dali) chi += 1;
else {
guozi += 50;
fenshu += 50;
last3 = 0;
gotoxy(now3 / 27, now3 % 27);
if (changdi[now3 / 27][now3 % 27] == 1) printf("·"); else printf(" ");
now3 = 341;
}
}
}
if (chi) beichi++;
}
void ChiDouRen()
{
Q2 = &beichi;
system("color 07"); //设置背景色为黑色,字体颜色为黑色
cout << "*********************************************** 吃 豆 人 **************************************************" << endl;
cout << " 游戏说明:" << endl;
cout << " ① 玩家通过按键I、J、K、L配合回车键进行移动,J为向左移动,K为向下移动,L为向右移动,I为向上移动;" << endl;
cout << " ② 游戏胜利条件为不被怪物吃掉并且吃满35个豆子;" << endl;
cout << " ③ 被怪物吃掉后游戏不会终止,但是将失去游戏奖励,判定为游戏失败。" << endl << endl << endl;
Sleep(3000);
system("pause");
system("cls");
begin();
int jixu = 1;
reset();
string bb[4] = { "●","①","②","③" }; color(7);
gotoxy(12, 12); cout << "进入倒计时开始!";
color(12);
for (int i = 3; i >= 0; i--) { if (i == 0) color(11); gotoxy(13, 13); cout << bb[i]; Sleep(1000); }
gotoxy(12, 12); cout << " ";
gotoxy(13, 13); cout << " ";
color(7);
while (!ff) {
Sleep(1);
gotoxy(10, 30); cout << "你最后的得分是:" << fenshu;//gotoxy(行,列)坐标
gotoxy(8, 30); cout << "怪物速度: " << 300 - t2;
gotoxy(9, 30); cout << "你的速度: " << 300 - t1;
gotoxy(15, 30); cout << "被吃次数:" << beichi;
if (_kbhit()) shuru();//这个这个
if (stopped) continue;
T1 = (T1 + 1) % t1; T2 = (T2 + 1) % t2;
if ((T1 % t1 == 0 && now + fx[fangx] > 0) && (now + fx[fangx] < nn)) move1();
if (T2 % t2 == 0) {
if (guaitimer <= 8) {
if (guaitimer == 0) gg1 = 1;
if (guaitimer == 8) gg2 = 1;
guaitimer++;
}
if (!gg3 && fenshu >= 30) gg3 = 1;
move2();
}
if (fenshu == guozi || fenshu == 35)ff = 2;
}
if (ff == 2) {
Sleep(2000);
system("cls");
cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
cout << "\t\t\t\t\t\t 恭喜您吃完了35个豆子!!!" << endl;
Sleep(2000);
cout << "\t\t\t\t\t\t 您一共被怪物吃掉了" << beichi << " 次";
Sleep(2000);
}
}
void setdata() //数据的初始化函数
{
snake_x[0] = high / 2; snake_y[0] = width / 3; //初始化蛇头,在地图内的位置随意
snake_x[1] = high / 2; snake_y[1] = width / 3 + 1; //初始化蛇身
snake_length = 2; //蛇的原始尺寸(一格头一格身子)
food_x = high / 3, food_y = width / 3; //初始化食物的位置,在地图内位置随意
SCORE = 0;
int i, j;
Map[snake_x[0]][snake_y[0]] = 4; //蛇头
Map[snake_x[1]][snake_y[1]] = 1; //蛇身
Map[food_x][food_y] = 2; //食物
for (i = 0; i < high; i++) //墙
for (j = 0; j < width; j++)
if (i == 0 || j == 0 || i == high - 1 || j == width - 1)
Map[i][j] = 3;
}
void Gotoxy(int x, int y) //画面打印
{
HANDLE handle = GetStdHandle(STD_OUTPUT_HANDLE);
COORD pos;
pos.X = x;
pos.Y = y;
SetConsoleCursorPosition(handle, pos);
}
void show()
{
Gotoxy(0, 0);
int i, j;
for (i = 0; i < high; i++)
{
for (j = 0; j < width; j++)
{
if (Map[i][j] == 0)
cout << " ";
else if (Map[i][j] == 1)
cout << "+";
else if (Map[i][j] == 2)
cout << "@";
else if (Map[i][j] == 3)
cout << "*";
else if (Map[i][j] == 4)
cout << "0";
}
printf("\n");
}
printf("得分:%d", SCORE);
}
int updatewithoutinput() //与输入无关的更新
{
int i;
if (snake_x[0] == food_x && snake_y[0] == food_y)
{
SCORE++;
srand((unsigned)time(NULL)); //srand和rand函数连用产生随机数,一般以时间作为产生随机数的种子
food_x = rand() % (high - 3) + 1;
food_y = rand() % (width - 3) + 1;
Map[food_x][food_y] = 2;
snake_length++;
}
if (snake_x[0] == 0 || snake_x[0] == high - 1 || snake_y[0] == 0 || snake_y[0] == width - 1) //碰墙了
{
cout << "游戏结束!" << endl;
Sleep(2000);
return 1;
}
for (i = 1; i < snake_length; i++) //碰到自己了 ,遍历蛇身找是否和蛇头重复
if (snake_x[0] == snake_x[i] && snake_y[0] == snake_y[i])
{
cout << "游戏结束" << endl;
Sleep(2000);
return 1;
}
}
int updatewithinput()
{
int i = 1;
if (kbhit())
input = getch();
if (input != '\0') //input!='\0'(空)表示当有输入的时候开始更新画面,这是游戏开始的条件
{
if (input == 'w' || input == 'a' || input == 's' || input == 'd')
{
if (primeinput == 'w' && input == 's' || primeinput == 's' && input == 'w' || primeinput == 'a' && input == 'd' || primeinput == 'd' && input == 'a')
{
system("cls");
cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
cout << "\t\t\t\t\t\t 世上没有回头路!!!" << endl;
Sleep(2000);
Death++;
return 1;
}
else
primeinput = input;
}
else if (primeinput == '.')
primeinput = 'w';
else if (input == 'p')
{
while (1)
{
char op;
op = getch();
if (op == 'p')
{
input = '.';
break;
}
}
}
else if (input == '+')
{
if (op >= 50) //表示最快速度为25 ms刷新一次
op = op / 2;
}
else if (input == '-')
{
if (op <= 1000) //表示最慢速度为 2000 ms刷新一次
op = op * 2;
}
Map[snake_x[snake_length - 1]][snake_y[snake_length - 1]] = 0;//蛇走过一格,蛇尾处变为空格
for (i = snake_length - 1; i > 0; i--)
{
snake_x[i] = snake_x[i - 1]; //走过一格后蛇身的坐标覆盖前面的坐标 (从后往前覆盖,蛇头也会被蛇身覆盖)
snake_y[i] = snake_y[i - 1];
Map[snake_x[i]][snake_y[i]] = 1;
}
}
if (primeinput == 'w')
snake_x[0]--;
else if (primeinput == 's')
snake_x[0]++;
else if (primeinput == 'a')
snake_y[0]--;
else if (primeinput == 'd')
snake_y[0]++;
Map[snake_x[0]][snake_y[0]] = 4; //蛇头的坐标覆盖前面的坐标
}
void tanchishe() //起始函数
{
cout << "************************************************ 贪 吃 蛇 **************************************************" << endl;
cout << " 游戏说明:" << endl;
cout << " ① 玩家通过按键w、a、s、d控制蛇的移动,w为向上移动,s为向下移动,a为向左移动,d为向右移动;" << endl;
cout << " ② 每吃到一次果实,蛇身长度+1,得分+1;" << endl;
cout << " ③ 撞到墙壁,即蛇死亡,来到结算界面;" << endl;
cout << " ④ 单局得分超过15分,则为游戏胜利,可获得20枚硬币奖励!" << endl;
cout << " 警告:请勿自噬(蛇头反向蛇身移动,撞向蛇身不算),自噬则蛇永久死亡,无法再次游玩游戏!!!" << endl << endl << endl;
Sleep(3000);
system("pause");
system("cls");
setdata();//数据初始化
Q3 = &SCORE;
while (1)
{
show(); //画面打印
Sleep(op);
int a = updatewithoutinput(); //与输入无关的更新
int b = updatewithinput(); //与输入有关的更新
if (a == 1 || b == 1)
{
break;
}
}
return;
}
void caishuzi()
{
cout << "*********************************************** 猜 数 字 *************************************************" << endl;
cout << " 游戏说明:" << endl;
cout << " ① 游戏会出现一个1~100的随机隐藏整数,玩家需要根据技巧猜测数字;" << endl;
cout << " ② 游戏很简单,但是如果加上猜测的次数限定呢?" << endl;
cout << " ③ 若猜测次数不超过8次,则游戏胜利,玩家可获得20硬币的奖励,否则即为失败;" << endl;
cout << " ④ 若玩家运气好到爆炸,一次就猜中,则视为中了彩票,将获得200硬币的奖励!!!" << endl;
cout << " 注:若一直猜不正确,可按888退出游戏" << endl << endl << endl;
Sleep(3000);
system("pause");
system("cls"); //清屏
Guesstimes = 0; //记录猜测次数,方便程序判定游戏是否胜利
srand((unsigned)time(NULL)); //依据时间的变化产生不同的随机数种子
int NUM = rand() % 100 + 1; //随机数发生器,随机生成1~100的整型数字
while (1) //永真循环
{
cout << "*********************************************** 猜 数 字 *************************************************";
cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
cout << "\t\t\t\t\t\t请输入您猜测的数字(整数):";
int Value = Check(0); //规范用户的输入,保证输入的为数字
if (Value == 888)
{
system("cls");
cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
cout << "\t\t\t\t\t\t 您已强制退出!!!" << endl;
Sleep(1000);
system("cls");
Guesstimes = 999;
break;
}
if (Value > NUM)
{
system("cls");
cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
cout << "\t\t\t\t\t\t 猜测过大!!!" << endl;
Sleep(1000);
system("cls");
Guesstimes++;
continue;
}
else if (Value < NUM)
{
system("cls");
cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
cout << "\t\t\t\t\t\t 猜测过小!!!" << endl;
Sleep(1000);
system("cls");
Guesstimes++;
continue;
}
else if (Value == NUM)
{
system("cls");
cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
cout << "\t\t\t\t\t\t 恭喜您,猜对啦!!!" << endl;
Sleep(2000);
system("cls");
Guesstimes++;
cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
cout << "\t\t\t\t\t\t 您猜测的次数为:" << Guesstimes << endl;
Sleep(2000);
system("cls");
break;
}
}
return;
}
int LianAiCeShi()
{
int N, SUMS = 0;
cout << "***************************************** 恋 爱 指 数 测 试 器 *****************************************" << endl;
cout << " 测试说明:" << endl;
cout << " ① 您需要对接下来的问题进行如实回答,你的心越纯,测试的结果越正确;" << endl;
cout << " ② 下列问题如果是则输入2,如果不是则输入1,一点也没感觉则输入0;" << endl;
cout << " ③ 加油,面对你自己!*-o-*" << endl;
cout << " 注:测试共包括10道题,一旦进入测试不可退出" << endl << endl << endl;
Sleep(3000);
system("pause");
system("cls");
cout << "进入测试请按3,退出测试请按4。" << endl;
Enter:
cout << "请给出你的选择:";
int choose = Check(0);
if (choose == 3) {
system("cls"); //清屏
cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
cout << "\t\t\t\t\t\t 开始测试!!!" << endl;
Sleep(2000);
system("cls");
}
else if (choose == 4) {
system("cls"); //清屏
cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
cout << "\t\t\t\t\t\t 您已退出测试!!!" << endl;
Sleep(2000);
system("cls");
return 0;
}
else {
system("cls"); //清屏
cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
cout << "\t\t\t\t\t\t无效输入,请重新选择!!!" << endl;
Sleep(2000);
system("cls");
goto Enter;
}
cout << "question one:" << "你是否面对异性时会心跳加速?" << endl;
N = Check(1);
SUMS += N;
cout << endl;
cout << "question two:" << "你是否看到异性被欺负时会很愤怒?" << endl;
N = Check(1);
SUMS += N;
cout << endl;
cout << "question three:" << "你是否惧怕见到异性的家长?" << endl;
N = Check(1);
SUMS += N;
cout << endl;
cout << "question four:" << "你是否经常刷一位异性的社交平台?" << endl;
N = Check(1);
SUMS += N;
cout << endl;
cout << "question five:" << "想不想和Ta用情侣头像?" << endl;
N = Check(1);
SUMS += N;
cout << endl;
cout << "question six:" << "和Ta邂逅过吗?" << endl;
N = Check(1);
SUMS += N;
cout << endl;
cout << "question seven:" << "吃过同一个饭碗里的东西吗?" << endl;
N = Check(1);
SUMS += N;
cout << endl;
cout << "question eight:" << "有过在梦里与Ta相遇吗?" << endl;
N = Check(1);
SUMS += N;
cout << endl;
cout << "question nine:" << "有为了等Ta一个人站在风雨中吗?" << endl;
N = Check(1);
SUMS += N;
cout << endl;
cout << "question ten:" << "想摸Ta的头发,牵TA的手吗?" << endl;
N = Check(1);
SUMS += N;
system("cls"); //清屏
cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
cout << "\t\t\t\t\t\t 正在测评中,请稍等......" << endl;
Sleep(3000);
system("cls");
if (SUMS >= 16 && SUMS <= 20)
{
cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
cout << "\t\t\t你的恋爱指数为:A。你是一个深深爱着Ta的人,你往往会守着这份爱走下去^-^。" << endl;
Sleep(5000);
system("cls");
}
if (SUMS <= 15 && SUMS >= 12)
{
cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
cout << "\t\t\t你的恋爱指数为:B。你是一个矛盾却又不失爱意的人,你的爱往往一波三折!-!。" << endl;
Sleep(5000);
system("cls");
}
if (SUMS <= 11 && SUMS >= 7)
{
cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
cout << "\t\t 你的恋爱指数为:C。你是一个有点心思的人,你想表白,却又惧怕现实,你仍须努力o-o。" << endl;
Sleep(5000);
system("cls");
}
if (SUMS <= 6 && SUMS >= 0)
{
cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
cout << "\t\t你的恋爱指数为:D。你是一个无暇无垢,不食人间烟火的人,想一路踏歌,但道路上仍需佳人陪伴+-+。" << endl;
Sleep(5000);
system("cls");
}
cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
cout << "\t 人生在世,恍如昨世,孤独的身影终难走远,你的那个Ta就在不远方,就如漫天繁星,总有一颗属于你!" << endl;
Sleep(2000);
cout << "\t\t\t\t\t 快抓紧你身边的那个Ta ^-^oooooo" << endl << endl << endl;
Sleep(3000);
system("pause");
peo[User].award++;
return 1;
}
void Gambler()
{
int GameCount = 0;//游戏次数
int dice1, dice2, dice3, sum;
int key1 = 0; //进入赌局的钥匙
srand((unsigned int)time(NULL)); //依据时间生成随机数的种子
cout << "*********************************************** 我 是 赌 神 *************************************************" << endl;
cout << " 赌场规则:" << endl;
cout << " ① 玩家必须缴纳5枚硬币来获取赌场通行证,并确保自己仍有剩余的硬币参与下注;" << endl;
cout << " ② 进入赌场后,玩家用硬币下注,随后会掷出三枚骰子,玩家需猜测三枚骰子之和为单数还是双数;" << endl;
cout << " ③ 猜中即可获得双倍奖励,否则将扣除双倍的硬币;" << endl;
cout << " ④ 若三枚骰子大小相同,则为大满贯,即无论您下的注是否猜中,您都将获得三倍奖励。" << endl;
cout << " 警告:进入赌场的玩家至少需进行5轮赌注,若强制退出,则视为违约,将扣除您硬币总数的一半" << endl << endl << endl;
Sleep(3000);
system("pause");//暂停游戏并熄屏
system("cls");
cout << "*********************************************** 我 是 赌 神 *************************************************";
cout << endl << endl << endl << endl << endl << endl << endl << endl << endl;
cout << "\t\t\t\t\t +--------------------------+" << endl;
cout << "\t\t\t\t\t | 是否进入赌场? |" << endl;
cout << "\t\t\t\t\t | 1.进入(需缴纳5枚硬币) | " << endl;
cout << "\t\t\t\t\t | 2.退出赌场 |" << endl;
cout << "\t\t\t\t\t +--------------------------+" << endl;
cout << "请输入数字实现对应的功能:";
int k = Check(2); //只返回1、2(是否进入赌场)
system("cls"); //清屏
if (k == 1 && peo[User].coin > 5)
{
peo[User].coin -= 5; //扣除5枚硬币作为入场券的费用
key1 = 1; //赌场开门
}
else if (k == 2)
{
cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
cout << "\t\t\t\t\t\t 退出成功!!!" << endl;
Sleep(3000); //延时3秒
return;
}
else if (peo[User].coin <= 5)
{
cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
cout << "\t\t\t\t\t\t您的硬币不足,已强制退出" << endl;
Sleep(3000); //延时3秒
return;
}
if (key1 == 1)
{
while (1)
{
if (peo[User].coin <= 0) //判断硬币数量是否还能继续游戏
{
system("cls"); //清屏
cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
cout << "\t\t\t\t\t\t 您倾家荡产,已强制退出" << endl;
Sleep(3000); //延时3秒
return;
}
int judge = 0;
cout << "*********************************************** 我 是 赌 神 *************************************************" << endl << endl;
cout << "\t\t您的硬币数量:" << peo[User].coin << "\t\t\t\t\t\t 当前下注次数:" << GameCount << endl << endl;
cout << "1.开始" << endl;
cout << "2.退出(下注未满5次会扣除您硬币总数的一半)" << endl;
cout << "请选择:";
int Choice = Check(2); //只返回1、2(是否开始游戏)
if (Choice == 1)
{
as: cout << "请输入您要压入硬币的数量(整数):";
int cn = Check(0); //规范输入 防止系统崩溃
cout << endl;
if (cn > peo[User].coin) //下注数大于硬币所有数
{
cout << "您的硬币不足!!!" << endl;
goto as;
}
cout << endl;
cout << "1.单数" << endl;
cout << "0.双数" << endl;
cout << "请下注:";
int Bat = Check(4); //只返回1、0(选择压单或双数)
system("cls");
cout << "*********************************************** 我 是 赌 神 *************************************************";
cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
cout << "\t\t\t\t\t\t 赌局开始!!!" << endl;
Sleep(2000);
system("cls");
cout << "*********************************************** 我 是 赌 神 *************************************************";
cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
cout << "\t\t\t\t\t\t 第" << ++GameCount << "轮骰子开始掷!" << endl;
Sleep(2000);
system("cls");
dice1 = 1 + rand() % 6;
dice2 = 1 + rand() % 6;
dice3 = 1 + rand() % 6; //随机扔三个骰子
sum = dice1 + dice2 + dice3;
cout << "*********************************************** 我 是 赌 神 *************************************************";
cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
cout << "\t\t\t\t\t\t " << dice1;
Sleep(1000);
system("cls");
cout << "*********************************************** 我 是 赌 神 *************************************************";
cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
cout << "\t\t\t\t\t\t " << dice1 << " " << dice2;
Sleep(1000);
system("cls");
cout << "*********************************************** 我 是 赌 神 *************************************************";
cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
cout << "\t\t\t\t\t\t " << dice1 << " " << dice2 << " " << dice3;
Sleep(2000);
system("cls");
cout << "*********************************************** 我 是 赌 神 *************************************************";
cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
cout << "\t\t\t\t\t\t 骰子大小之和为: " << sum << endl;
Sleep(2000);
system("cls");
if (dice1 == dice2 && dice2 == dice3) //判断是否三个骰子数都相同 (即大满贯)
{
cout << "*********************************************** 我 是 赌 神 *************************************************";
cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
cout << "\t\t\t\t\t\t大满贯,获得3倍奖励!!!" << endl;
peo[User].coin += 3 * cn;
judge = 1;
Sleep(3000);
system("cls");
continue;
}
if (sum % 2 == Bat)
{
cout << "*********************************************** 我 是 赌 神 *************************************************";
cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
cout << "\t\t\t\t\t\t 猜测正确,双倍奖励!!!" << endl;
peo[User].coin += 2 * cn;
Sleep(3000);
system("cls");
continue;
}
else if (sum % 2 != Bat)
{
cout << "*********************************************** 我 是 赌 神 *************************************************";
cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
cout << "\t\t\t\t\t\t 猜测错误,硬币扣除" << endl;
peo[User].coin -= 2 * cn;
Sleep(3000);
system("cls"); //清屏
continue;
}
} //押单则bat=1,押双数则bat=0
else if (Choice == 2) //选择退出游戏
{
if (GameCount < 5)
{
system("cls"); //清屏
cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
cout << "\t\t\t\t\t 警告:您游戏未满5次,已扣除硬币总数的一半!!!" << endl;
Sleep(3000); //延时3秒
peo[User].coin /= 2; //硬币扣除硬币总数一半
return;
}
else
{
system("cls"); //清屏
cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
cout << "\t\t\t\t\t\t 您全身而退!!!" << endl;
Sleep(3000); //延时3秒
return;
}
}
}
}
}
int main()
{
system("color F0"); //设置背景色为白色,字体颜色为黑色
HideCursor(); //影藏光标
cout << "+------------------+" << endl;
cout << "| 第二小组 |" << endl;
cout << "| 组长:豆漿油條 |" << endl;
cout << "| 组员:小哲 |" << endl;
cout << "| 小栩 |" << endl;
cout << "| 小欣 |" << endl;
cout << "| 小蕊 |" << endl;
cout << "| 小蓁 |" << endl;
cout << "| 小函 |" << endl;
cout << "+------------------+" << endl << endl << endl << endl;
cout << "\t\t\t\t\t\t 欢迎游玩2172游戏盒!!!" << endl;
Sleep(3000); //延时3秒
system("cls"); //清屏
cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
cout << "\t\t\t\t\t 抵 制 不 良 游 戏 , 拒 绝 盗 版 游 戏 。" << endl;
cout << "\t\t\t\t\t 注 意 自 我 保 护 , 谨 防 受 骗 上 当 。" << endl;
cout << "\t\t\t\t\t 适 度 游 戏 益 脑 , 沉 迷 游 戏 伤 身 。" << endl;
cout << "\t\t\t\t\t 合 理 安 排 时 间 , 享 受 健 康 生 活 。" << endl;
Sleep(6000); //延时6秒
system("cls"); //清屏
while (1)
{
while (1)
{
cout << endl << endl << endl << endl << endl << endl << endl << endl << endl;
cout << "\t\t\t\t\t\t +--------------------+" << endl;
cout << "\t\t\t\t\t\t | 是否已有账号? |" << endl;
cout << "\t\t\t\t\t\t | 1.有,直接登录 | " << endl;
cout << "\t\t\t\t\t\t | 2.没有,申请注册 |" << endl;
cout << "\t\t\t\t\t\t | 0.退出程序 |" << endl;
cout << "\t\t\t\t\t\t +--------------------+" << endl;
cout << "请输入数字实现对应的功能:";
float k = Check(1); //只返回1、2、0
if (k == 1) //登录
{
system("cls"); //清屏
int a = SignIn();
if (a == 1) //选择直接进入程序
{
Key = 1; //钥匙开锁,可进入主程序
system("cls"); //清屏
break;
}
else
{
continue;
}
}
else if (k == 2) //注册
{
system("cls"); //清屏
int b = Register();
if (b == 1) //选择直接进入程序
{
Key = 1; //钥匙开锁,可进入主程序
system("cls"); //清屏
break;
}
else if (b == 2) //选择不直接进入程序
{
system("cls"); //清屏
continue;
}
}
else if (k == 0) //退出程序
{
cout << "\n你真的要退出了吗?" << endl;
cout << "1.强忍离去" << endl;
cout << "2.继续使用" << endl;
float a = Check(2);
cout << endl << endl;
if (a == 1)
{
break;
}
else if (a == 2)
{
system("cls"); //清屏
continue;
}
}
}
if (Key == 1)
{
Progress(); //进度条
cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
cout << "\t\t\t\t\t\t 你好," << peo[User].user << endl;
cout << "\t\t\t\t\t\t 欢迎进入游戏世界!!!" << endl;
Sleep(3000); //延时3秒
system("cls"); //清屏
while (1)
{
system("color F0"); //设置背景色为白色,字体颜色为黑色
cout << "***************************************************** 2172游戏盒 *****************************************************" << endl;
cout << "\t\t\t\t\t\t Version 8.9.11" << endl;
cout << " 玩家:" << peo[User].user << setw(15) << "硬币:" << peo[User].coin << endl;
cout << "+------------------+" << endl;
cout << "| 1.雷霆战机 |" << endl;
cout << "| 2.吃豆人 |" << endl;
cout << "| 3.贪吃蛇 |" << endl;
cout << "| 4.猜数字 |" << endl;
cout << "| 5.恋爱测试 |" << endl;
cout << "| 6.我是赌神 |" << endl;
cout << "| |" << endl;
cout << "| |" << endl;
cout << "| 9.退出登录 |" << endl;
cout << "| 0.退出程序 |" << endl;
cout << "+------------------+" << endl;
cout << "请输入您要游玩的游戏编号:";
double n = Check(0);
cout << endl << endl;
if (n == 1)
{
system("cls"); //清屏
PlaneWar();
system("cls"); //清屏
if (*Q1 > 200)
{
cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
cout << "\t\t\t\t\t\t 游戏胜利,硬币+30" << endl;
Sleep(3000);
system("cls"); //清屏
peo[User].coin += 30;
continue;
}
else
{
cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
cout << "\t\t\t\t\t\t 游戏失败,继续加油" << endl;
Sleep(3000);
system("cls"); //清屏
continue;
}
}
else if (n == 2)
{
system("cls"); //清屏
ChiDouRen();
system("cls"); //清屏
if (*Q2 == 0)
{
cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
cout << "\t\t\t\t\t\t 游戏胜利,硬币+10" << endl;
Sleep(3000);
system("cls"); //清屏
peo[User].coin += 10;
continue;
}
else
{
cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
cout << "\t\t\t\t\t\t 游戏失败,继续加油" << endl;
Sleep(3000);
system("cls"); //清屏
continue;
}
}
else if (n == 3)
{
system("cls"); //清屏
if (Death == 1)
{
cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
cout << "\t\t\t\t\t\t 蛇已死,自噬无法复活!!!" << endl;
Sleep(3000);
system("cls"); //清屏
}
else if (Death == 0)
{
tanchishe();
system("cls"); //清屏
if (*Q3 > 15)
{
cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
cout << "\t\t\t\t\t\t 游戏胜利,硬币+20" << endl;
Sleep(3000);
system("cls"); //清屏
peo[User].coin += 10;
continue;
}
else
{
cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
cout << "\t\t\t\t\t\t 游戏失败,继续加油" << endl;
Sleep(3000);
system("cls"); //清屏
continue;
}
}
}
else if (n == 4)
{
system("cls"); //清屏
caishuzi();
system("cls"); //清屏
if (Guesstimes == 1)
{
cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
cout << "\t\t\t\t\t\t 您运气爆棚,硬币+200" << endl;
Sleep(3000);
system("cls"); //清屏
peo[User].coin += 200;
continue;
}
else if (Guesstimes <= 8)
{
cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
cout << "\t\t\t\t\t\t 游戏胜利,硬币+20" << endl;
Sleep(3000);
system("cls"); //清屏
peo[User].coin += 20;
continue;
}
else
{
cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
cout << "\t\t\t\t\t\t 游戏失败,继续加油" << endl;
Sleep(3000);
system("cls"); //清屏
continue;
}
}
else if (n == 5)
{
system("cls"); //清屏
int GETG = LianAiCeShi();
system("cls"); //清屏
if (GETG == 1 && peo[User].award == 1)
{
cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
cout << "\t\t\t\t\t\t 恋爱测试结束!!!" << endl;
Sleep(2000);
system("cls"); //清屏
cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
cout << "\t\t\t\t\t 赠送您50硬币,祝您早日找到那个TA!!!" << endl;
Sleep(2000);
peo[User].coin += 50;
system("cls"); //清屏
}
continue;
}
else if (n == 6)
{
system("cls"); //清屏
Gambler();
if (peo[User].coin < 0)
{
peo[User].coin = 0; //硬币下限为0
}
system("cls"); //清屏
continue;
}
else if (n == 9)
{
system("cls"); //清屏
cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
cout << "\t\t\t\t\t\t 存档中......" << endl;
Sleep(2000); //延时2秒
system("cls"); //清屏
cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
cout << "\t\t\t\t\t\t 账号已退出!!!" << endl;
Sleep(2000); //延时2秒
system("cls"); //清屏
Key = 0; //程序关锁
KeyOut = 1; //钥匙开锁,退出登录
break;
}
else if (n == 0)
{
cout << "你真的要退出了吗?" << endl;
cout << "1.强忍离去" << endl;
cout << "2.继续使用" << endl;
float a = Check(2);
cout << endl << endl;
if (a == 1)
{
break;
}
else if (a == 2)
{
system("cls"); //清屏
continue;
}
}
else if (n == 12321) //查看所有玩家的信息
{
system("cls"); //清屏
cout << setw(10) << "序号" << setw(16) << "用户名" << setw(16) << "密码" << setw(10) << "硬币" << endl;
for (int i = 0; i < x; i++)
{
cout << setw(10) << peo[i].number << setw(16) << peo[i].user << setw(16) << peo[i].password << setw(10) << peo[i].coin << endl;
}
system("pause");
system("cls"); //清屏
}
else if (n == 12345)
{
system("cls"); //清屏
cout << setw(10) << "编号" << setw(16) << "用户名" << setw(16) << "密码" << setw(10) << "硬币" << endl;
for (int i = 0; i < x; i++)
{
cout << setw(10) << peo[i].number << setw(16) << peo[i].user << setw(16) << peo[i].password << setw(10) << peo[i].coin << endl;
}
cout << endl << endl << "请输入要修改信息的玩家编号:";
int fo = Check(0) - 1;
cout << endl;
cout << "请输入要修改的信息:" << endl;
cout << "1.用户名" << endl;
cout << "2.密码" << endl;
cout << "3.硬币" << endl;
int ko = Check(3);
if (ko == 1)
{
cout << endl << "用户名修改为:";
char us1[1000];
cin.get();
cin.getline(us1, 1000);
strcpy(peo[fo].user, us1);
system("cls"); //清屏
cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
cout << "\t\t\t\t\t\t 正在处理,请稍等......" << endl;
Sleep(2000); //等待2秒
system("cls"); //清屏
cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
cout << "\t\t\t\t\t\t 修改成功!!!" << endl;
}
else if (ko == 2)
{
cout << endl << "密码修改为:";
char us2[1000];
cin.get();
cin.getline(us2, 1000);
strcpy(peo[fo].password, us2);
system("cls"); //清屏
cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
cout << "\t\t\t\t\t\t 正在处理,请稍等......" << endl;
Sleep(2000); //等待2秒
system("cls"); //清屏
cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
cout << "\t\t\t\t\t\t 修改成功!!!" << endl;
}
else if (ko == 3)
{
cout << endl << "硬币数量修改为:";
long long us3 = Check(0);
peo[fo].coin = us3;
system("cls"); //清屏
cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
cout << "\t\t\t\t\t\t 正在处理,请稍等......" << endl;
Sleep(2000); //等待2秒
system("cls"); //清屏
cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
cout << "\t\t\t\t\t\t 修改成功!!!" << endl;
}
Sleep(2000);
system("cls"); //清屏
}
else
{
system("cls"); //清屏
cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
cout << "\t\t\t\t\t 您输入的数字不在菜单中,请重新输入!!!" << endl;
Sleep(2000);
system("cls"); //清屏
}
}
}
if (KeyOut == 1)
{
KeyOut = 0; //钥匙使用过后关锁,以便后续使用
continue;
}
else if (KeyOut == 0)
{
system("cls"); //清屏
cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << "\t\t\t\t\t\t 期待您的下次游玩!" << endl;
Sleep(3000); //延时3秒
break;
}
}
return 0;
}
15.游戏盒子(2)极其推荐
#include<bits/stdc++.h>
#include<iomanip>
#include<conio.h>
#include<windows.h>
#include<cstdio>
#include<ctime>
#define bottom 40
#define jumph 6
#define skills 6
#define skilled 2
#define Setcolor(NAME) if(NAME)SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_RED | FOREGROUND_INTENSITY | BACKGROUND_INTENSITY | BACKGROUND_GREEN | BACKGROUND_BLUE);else SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_BLUE | FOREGROUND_INTENSITY | BACKGROUND_INTENSITY | BACKGROUND_GREEN | BACKGROUND_BLUE)
#define Backcolor(NAME) if(NAME)SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_BLUE | FOREGROUND_INTENSITY | BACKGROUND_INTENSITY | BACKGROUND_GREEN | BACKGROUND_BLUE)
#define Choosecolor(NAME) if(NAME==2)SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_RED| FOREGROUND_GREEN|FOREGROUND_BLUE | FOREGROUND_INTENSITY|BACKGROUND_BLUE );else if(!NAME)SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_BLUE | FOREGROUND_RED| BACKGROUND_INTENSITY| BACKGROUND_GREEN|BACKGROUND_RED|BACKGROUND_BLUE );else if(NAME==1)SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_BLUE | FOREGROUND_INTENSITY | BACKGROUND_INTENSITY| BACKGROUND_GREEN|BACKGROUND_RED)
using namespace std;
void HideCursor();
void go(int x, int y);
void movewindow();
void GetContain();
void start1();
void start2();
void _skillprint(int, int);
void skillprint(int,int);
void mapprint();
void Getmove();
void winprint(bool);
void BoomGet();
void setbomb(bool a[11][11],int x[11][11],int n,int *c,int *d,bool op[11][11]);//设置炸弹函数
void printo(bool a[11][11],int x[11][11],bool op[11][11],bool utisb[11][11]);//输出全盘函数
void ingame(bool a[11][11],int x[11][11],bool op[11][11]);//进入游戏函数
void search(int n,int b,bool op[11][11],int a[11][11],bool checked[11][11],bool zxc[11][11]);//如果点到空,继续查找的函数
void done_searching(int n,int b,bool op[11][11],int a[11][11],bool checked[11][11],bool zxc[11][11]);//完成如果点到空,继续查找的函数
class bullet;
class player;
int a[24][17],i,j,tim=800,ti=800,shape=0,v,bn,ta[4][4],turn[4][4],nex[4][4],nextshape,add=0,score=0,speed=1;
bool dj1, dj2, s11, s12, s21, s22;
int da1, da2,skill1[2] = { 4,3 }, skill2[2] = {2,4}, boom1, boom2, cost[10] = {0,3,3,5,15},place[11][2][2],explace[11][2];//[???üêy×?][ê?óú][x,y×?±ê]
float cool[2][2];
char hit[2];
string name1, name2,contain[11],excontain[11];
vector<bullet>bu;
int choice;
char aa=0,b=0,c=0,d=0;
int user_input;
unsigned long long int ttttpppp=0;
class player {
public:
int x, y, j, jh, life,loving,flying,gaying;
char a, b[2];
bool dir, fly, myself,fdir;
void clear() {
go(x, y);
printf(" ");
go(x, y + 1);
printf(" ");
}
void print() {
Setcolor(myself);
if (gaying)SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_BLUE|FOREGROUND_RED | BACKGROUND_INTENSITY | BACKGROUND_GREEN | BACKGROUND_BLUE);
go(x, y);
if (loving) {
Setcolor(!myself);
cout << (char)3;
Setcolor(myself);
} else if (gaying)cout << "?á";
else cout << a;
go(x, y + 1);
cout << b[dir];
Backcolor(myself);
}
void lifedown(int l) {
if (!myself) {
go(life - l+1, 2);
for (int i = 1; i <= l; ++i)
cout << " ";
} else {
go(188 - life, 2);
for (int i = 1; i <= l; ++i)
cout << " ";
}
life -= l;
}
void jump() {
++j;
if (j <= jh) {
clear();
--y;
print();
} else fly = 1;
}
void flown() {
++flying;
clear();
if (flying <= jumph-1)--y;
else if (flying <= 2 * jumph-2)++y;
else flying = 0;
if (!fdir)x-=2;
else x+=2;
if (x < 1)x = 1;
else if (x > 188)x = 188;
print();
}
void skill(int,bool);
void attack();
void move(int);
} p1, p2;
class bullet {
public:
int x, y, boom,length,soap;
bool own, dir, love;
inline void clear() {
go(x, y);
cout << " ";
}
void print() {
Setcolor(own);
go(x, y);
if (boom)cout << (char)15;
else if (love)cout << (char)3;
else if (soap) cout << "¨|";
else cout << hit[own];
Backcolor(own);
}
void start(int p, int q, bool d, bool o) {
y = q;
dir = d;
own = o;
if (!d)x = p - 1;
else x = p + 1;
boom = 0;
love = 0;
length = 0;
soap = 0;
}
void boomstart(int p, int q, bool d, bool o,int l) {
y = q + 1;
dir = d;
own = o;
if (!d)x = p - 1;
else x = p + 1;
boom = 1;
length = l;
love = 0;
}
bool fly() {
if (boom >= 800) {
if (boom == 805) {
for (int i = -4; i <= 4; i += 2)
for (int j = -2; j <= 2; ++j) {
if (x + i < 1 || x + i>188 || y + j > bottom + 1)continue;
go(x + i, y + j);
cout << " ";
}
p1.print();
p2.print();
return 1;
}++boom;
return 0;
}
if(soap!=-1)clear();
if (!dir)--x;
else ++x;
if (boom) {
if (!dir)x-=length;
else x+=length;
}
if (boom) {
++boom;
char _sign = 4;
if (x < 1 || x>188) {
Setcolor(own);
for (int i = -4; i <= 4; i += 2)
for (int j = -2; j <= 2; ++j) {
if (x + i < 1 || x + i>188 || y + j > bottom + 1)continue;
go(x + i, y + j);
cout <<_sign ;
}
Backcolor(own);
if (!own) {
if (x >= p2.x - 4 && x <= p2.x + 4 && y+2 >= p2.y&&y-2 <= p2.y + 1) {
p2.lifedown(10);
if (x > p2.x)p2.fdir = 0;
else p2.fdir = 1;
p2.flown();
}
} else {
if (x >= p1.x - 4 && x <= p1.x + 4 && y + 2 >= p1.y&&y - 2 <= p1.y + 1) {
p1.lifedown(10);
if (x >= p1.x)p1.fdir = 0;
else p1.fdir = 1;
p1.flown();
}
}
boom = 800;
return 0;
}
if (boom <= 2 * jumph+length)--y;
else if (boom > 2 * jumph + 2+length) {
if (y <= bottom)++y;
else {
Setcolor(own);
for (int i = -4; i <= 4; i += 2)
for (int j = -2; j <= 2; ++j) {
if (x + i < 1 || x + i>188 || y + j > bottom + 1)continue;
go(x + i, y + j);
cout << _sign;
}
Backcolor(own);
if (!own) {
if (x >= p2.x - 4 && x <= p2.x + 4 && y +2>= p2.y&&y-2 <= p2.y + 1) {
p2.lifedown(10);
if (x > p2.x)p2.fdir = 0;
else p2.fdir = 1;
p2.flown();
}
} else {
if (x >= p1.x - 4 && x <= p1.x + 4 && y + 2 >= p1.y&&y - 2 <= p1.y + 1) {
p1.lifedown(10);
if (x >= p1.x)p1.fdir = 0;
else p1.fdir = 1;
p1.flown();
}
}
boom = 800;
return 0;
}
}
print();
if (!own) {
if (x == p2.x&&y >= p2.y&&y <= p2.y + 1) {
for (int i = -4; i <= 4; i += 2)
for (int j = -2; j <= 2; ++j) {
if (x + i < 1 || x + i>188 || y + j > bottom + 1)continue;
go(x + i, y + j);
cout << _sign;
}
p2.lifedown(10);
p2.fdir = 1;
p2.flown();
boom = 800;
}
} else {
if (x == p1.x&&y >= p1.y&&y <= p1.y + 1) {
Setcolor(own);
for (int i = -4; i <= 4; i += 2)
for (int j = -2; j <= 2; ++j) {
if (x + i < 1 || x + i>188 || y + j > bottom + 1)continue;
go(x + i, y + j);
cout << _sign;
}
Backcolor(own);
p1.lifedown(10);
p1.fdir = 0;
p1.flown();
boom = 800;
}
}
return 0;
}
if (soap) {
if (soap!=-1&&soap <= 2) {
++soap;
--y;
} else if (soap != -1 && y <= bottom+1) {
++y;
if (y == bottom + 1)
soap = -1;
} else {
if (!dir)++x;
else --x;
}
if (x < 1)x = 1;
if (x > 188)x = 188;
if (soap != -1) {
int s = bu.size();
for (register int i = 0; i < s; ++i) {
if (bu[i].soap&&bu[i].length!=length) {
if (x+1>=bu[i].x&&x<=bu[i].x+1&&y ==bu[i].y-1 ) {
soap = -1;
break;
}
}
}
}
if (!own) {
if (x+1 >= p2.x&&x<=p2.x&&y >= p2.y&&y <= p2.y + 1) {
p2.lifedown(8);
p2.gaying += 100;
p2.print();
return 1;
}
} else {
if (x +1>= p1.x&&x<=p1.x&&y >= p1.y&&y <= p1.y + 1) {
p1.lifedown(8);
p1.gaying += 100;
p1.print();
return 1;
}
}
print();
return 0;
}
if (x < 1 || x>188) {
if (!love) {
if (!own) {
if ((skill1[0] == -2 || skill1[1] == -2) && !length) {
if (!dir)
++x;
else --x;
dir = !dir;
++length;
return 0;
}
} else {
if ((skill2[0] == -2 || skill2[1] == -2) && !length) {
if (!dir)++x;
else --x;
dir = !dir;
++length;
return 0;
}
}
}
return 1;
}
if (!own) {
if (x == p1.x&&y >= p1.y&&y <= p1.y + 1)p1.print();
if (x == p2.x&&y >= p2.y&&y <= p2.y + 1) {
if (love) {
p2.lifedown(3);
p2.loving = 75;
p2.print();
} else p2.lifedown(1);
return 1;
}
} else {
if (x == p2.x&&y >= p2.y&&y <= p2.y + 1)p2.print();
if (x == p1.x&&y >= p1.y&&y <= p1.y + 1) {
if (love) {
p1.lifedown(3);
p1.loving = 75;
p1.print();
} else p1.lifedown(2);
return 1;
}
}
print();
return 0;
}
} temp;
void player::attack() {
temp.start(x, y, dir, myself);
bu.push_back(temp);
}
void player::move(int k) {
clear();
if (gaying)k = 3 - k;
if (k == 1) {
--x;
dir = 0;
} else if (k == 2) {
++x;
dir = 1;
}
int strb = bu.size();
for (register int i = 0; i < strb; ++i) {
if (bu[i].boom == 0 && bu[i].own != myself && bu[i].x == x && bu[i].y >= y && bu[i].y <= y + 1) {
bu.erase(bu.begin() + i);
if (bu[i].soap) {
gaying += 100;
lifedown(5);
} else if (bu[i].love) {
lifedown(2);
loving =75;
} else lifedown(1);
--i;
--strb;
}
}
print();
}
void player::skill(int l,bool which) {
if (l <= 0)return;
if (cool[myself][which] > 0)return;
cool[myself][which] += cost[l];
skillprint(myself, which);
if (l == 1) {
int sign = 0;
bool sign2 = 0;
if (!dir) {
for (register int i = 1; x > 1 && i <= 12; ++i) {
x -= 2;
if (x < 1) {
x = 1;
sign2 = 1;
}
print();
++sign;
}
for (register int i = 2 - sign2; i <= 2 - sign2 + 2 * sign; i += 2) {
go(x + i, y);
cout << " ";
go(x + i, y + 1);
cout << " ";
Sleep(1);
}
} else {
for (register int i = 1; x < 188 && i <= 12; ++i) {
x += 2;
if (x > 188) {
x = 188;
sign2 = 1;
}
print();
++sign;
}
for (register int i = 2 - sign2; i <= 2 - sign2 + 2 * sign; i += 2) {
go(x - i, y);
cout << " ";
go(x - i, y + 1);
cout << " ";
Sleep(1);
}
}
} else if (l == 2) {
if(!myself)temp.boomstart(x, y, dir, myself,boom1/6);
else temp.boomstart(x, y, dir, myself, boom2 /6);
bu.push_back(temp);
} else if (l == 3) {
temp.start(x, y, dir, myself);
temp.love = 1;
bu.push_back(temp);
} else if (l == 4) {
temp.start(x, y, dir, myself);
temp.soap = 1;
temp.length = rand();
bu.push_back(temp);
}
}
void go(int x, int y) {
COORD p;
p.X = x - 1;
p.Y = y - 1;
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), p);
}
void movewindow() {
RECT rect;
HWND hwnd = GetForegroundWindow();
GetWindowRect(hwnd, &rect);
MoveWindow(hwnd, 0, 0, 0, 0, TRUE);
}
void HideCursor() {
CONSOLE_CURSOR_INFO cursor_info = { 1, 0 };
SetConsoleCursorInfo(GetStdHandle(STD_OUTPUT_HANDLE), &cursor_info);
}
void start1() {
go(20, 20);
printf("玩家一的名字:");
getline(cin, name1);
go(20, 23);
printf("玩家二的名字");
getline(cin, name2);
Sleep(500);
system("cls");
}
inline void GetContain() {
contain[1] = "| 闪现 |";
contain[2] = "| 手雷 |";
contain[3] = "| 魅惑 |";
contain[4] = "| 捡肥皂 |";
contain[5] = "| 三段跳 |";
contain[6] = "| 弹射 |";
excontain[1] = "向前瞬移一段距离 冷却 3 s";
excontain[2] = "长摁后扔出一枚手雷,造成伤害并炸飞对手。蓄力时间越长,飞行距离越远 冷却 3 s";
excontain[3] = "发出一颗爱心,造成伤害并使对手无法控制地走向自己 冷却 5 s";
excontain[4] = "扔出一个肥皂,对手捡到时造成伤害并干扰对手的移动 冷却 15 s";
excontain[5] = "(被动)可以连续跳跃三次";
excontain[6] = "(被动)普通攻击第一次碰到墙壁时会反弹回来";
place[1][0][0] = 25;
place[1][0][1] = 10;
place[1][1][0] = place[1][0][0]+85;
place[1][1][1] = 10;
for (int k = 0; k <= 1; ++k) {
for (int i = 2; i <= skills; ++i) {
place[i][k][0] = place[i - 1][k][0];
place[i][k][1] = place[i - 1][k][1] + 3;
}
}
for (int k = 0; k <= 1; ++k)
for (int i = 1; i <= skills; ++i)
explace[i][k] = place[1][k][0]+18 - excontain[i].size()/2;
}
void start2() {
GetContain();
const int exy = place[skills][0][1]+5;
int wh[2] = {1,1};
int ch[2][11] = { {0,1,0,0,0,0,0,0,0,0,0},{0,1,0,0,0,0,0,0,0,0,0,}};
int count[2] = { 0,0 };
char sign = 16;
go(82, 2);
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), BACKGROUND_BLUE|BACKGROUND_GREEN|BACKGROUND_INTENSITY);
cout << "选择你的技能";
go(54, 45);
cout << "游戏规则:玩家一 A、D键移动,W键跳跃,J键攻击,K、L键释放技能";
go(64, 46);
cout << "玩家二 方向键跳跃和移动,1 键攻击,2、3 键释放技能";
Setcolor(0);
go(44 - name1.size()/2, 5);
cout<<name1;
go(44, 7);
printf("%c", p1.a);
go(44, 8);
printf("%c", p1.b[0]);
Setcolor(1);
go(130-name2.size()/2,5);
cout<< name2;
go(130, 7);
printf("%c", p2.a);
go(130, 8);
printf("%c", p2.b[0]);
for(int i=0; i<=1; ++i)
for (int j = 1; j <= skills; ++j) {
go(place[j][i][0], place[j][i][1]);
Setcolor(i);
cout << " ";
Choosecolor(ch[i][j]);
cout << contain[j];
}
Choosecolor(1);
for (int i = 0; i <= 1; ++i) {
go(place[1][i][0], place[1][i][1]);
Setcolor(i);
cout<<sign;
go(explace[1][i], exy);
cout << excontain[1];
}
bool able[2][3] = { {0,0,0},{0,0,0} };//[0×ó 1óò][0é? 1?? 2??]
go(30, 40);
Setcolor(0);
cout << "玩家一:W、S键移动,J键选择";
go(112, 40);
Setcolor(1);
cout << "玩家二:I、K键移动,L键选择";
while (count[0]<2||count[1]<2) {
bool f = 0;
if (GetKeyState('W') >= 0)able[0][0]=1;
if (GetKeyState('S') >= 0)able[0][1] = 1;
if (GetKeyState('J') >= 0)able[0][2] = 1;
if (GetKeyState('I') >= 0)able[1][0] = 1;
if (GetKeyState('K') >= 0)able[1][1] = 1;
if (GetKeyState('L') >= 0)able[1][2] = 1;
Sleep(5);
if (GetKeyState('W') < 0&&able[f][0]) {
if(ch[f][wh[f]]!=2)--ch[f][wh[f]];
able[f][0] = 0;
go(place[wh[f]][f][0], place[wh[f]][f][1]);
Setcolor(f);
cout << " ";
Choosecolor(ch[f][wh[f]]);
cout << contain[wh[f]];
Setcolor(f);
go(explace[wh[f]][f], exy);
for (unsigned int i = 0; i < excontain[wh[f]].size()/2+1; ++i)
cout << " ";
--wh[f];
if (wh[f] < 1)wh[f] = skills;
go(explace[wh[f]][f], exy);
cout << excontain[wh[f]];
if(ch[f][wh[f]]!=2)++ch[f][wh[f]];
go(place[wh[f]][f][0], place[wh[f]][f][1]);
cout << sign;
Choosecolor(ch[f][wh[f]]);
cout << contain[wh[f]];
}
if(GetKeyState('S')<0&&able[f][1]) {
if(ch[f][wh[f]]!=2)--ch[f][wh[f]];
able[f][1] = 0;
go(place[wh[f]][f][0], place[wh[f]][f][1]);
Setcolor(f);
cout << " ";
Choosecolor(ch[f][wh[f]]);
cout<< contain[wh[f]];
Setcolor(f);
go(explace[wh[f]][f], exy);
for (unsigned int i = 0; i < excontain[wh[f]].size()/2+1; ++i)
cout << " ";
++wh[f];
if (wh[f] > skills)wh[f] = 1;
go(explace[wh[f]][f], exy);
cout << excontain[wh[f]];
if (ch[f][wh[f]] != 2)++ch[f][wh[f]];
go(place[wh[f]][f][0], place[wh[f]][f][1]);
cout << sign;
Choosecolor(ch[f][wh[f]]);
cout << contain[wh[f]];
}
if (GetKeyState('J') < 0 && able[f][2]) {
able[f][2] = 0;
if (ch[f][wh[f]] != 2 && count[f] < 2) {
++ch[f][wh[f]];
++count[f];
} else if(ch[f][wh[f]]==2) {
--ch[f][wh[f]];
--count[f];
}
go(place[wh[f]][f][0], place[wh[f]][f][1]);
Setcolor(f);
cout << sign;
Choosecolor(ch[f][wh[f]]);
cout << contain[wh[f]];
}
f = 1;
if (GetKeyState('I') < 0 && able[f][0]) {
if (ch[f][wh[f]] != 2)--ch[f][wh[f]];
able[f][0] = 0;
go(place[wh[f]][f][0], place[wh[f]][f][1]);
Setcolor(f);
cout << " ";
Choosecolor(ch[f][wh[f]]);
cout << contain[wh[f]];
Setcolor(f);
go(explace[wh[f]][f], exy);
for (unsigned int i = 0; i < excontain[wh[f]].size()/2+1; ++i)
cout << " ";
--wh[f];
if (wh[f] < 1)wh[f] = skills;
go(explace[wh[f]][f], exy);
cout << excontain[wh[f]];
if (ch[f][wh[f]] != 2)++ch[f][wh[f]];
go(place[wh[f]][f][0], place[wh[f]][f][1]);
cout << sign;
Choosecolor(ch[f][wh[f]]);
cout << contain[wh[f]];
}
if (GetKeyState('K') < 0 && able[f][1]) {
if (ch[f][wh[f]] != 2)--ch[f][wh[f]];
able[f][1] = 0;
go(place[wh[f]][f][0], place[wh[f]][f][1]);
Setcolor(f);
cout << " ";
Choosecolor(ch[f][wh[f]]);
cout << contain[wh[f]];
Setcolor(f);
go(explace[wh[f]][f], exy);
for (unsigned int i = 0; i < excontain[wh[f]].size()/2+1; ++i)
cout << " ";
++wh[f];
if (wh[f] > skills)wh[f] = 1;
go(explace[wh[f]][f], exy);
cout << excontain[wh[f]];
if (ch[f][wh[f]] != 2)++ch[f][wh[f]];
go(place[wh[f]][f][0], place[wh[f]][f][1]);
cout << sign;
Choosecolor(ch[f][wh[f]]);
cout << contain[wh[f]];
}
if (GetKeyState('L')<0 && able[f][2]) {
able[f][2] = 0;
if (ch[f][wh[f]] != 2 && count[f] < 2) {
++ch[f][wh[f]];
++count[f];
} else if (ch[f][wh[f]] == 2) {
--ch[f][wh[f]];
--count[f];
}
go(place[wh[f]][f][0], place[wh[f]][f][1]);
Setcolor(f);
cout << sign;
Choosecolor(ch[f][wh[f]]);
cout << contain[wh[f]];
}
}
Backcolor(1);
int _s=0;
for (int i = 1; i <= skills; ++i) {
if (ch[0][i] == 2) {
if (i > skills - skilled)skill1[_s] = skills - i - 2;
else skill1[_s] = i;
++_s;
}
}
_s = 0;
for (int i = 1; i <= skills; ++i) {
if (ch[1][i] == 2) {
if (i > skills - skilled)skill2[_s] = skills - i - 2;
else skill2[_s] = i;
++_s;
}
}
Sleep(1000);
}
void Getmove() {
BoomGet();
if (GetKeyState('W') >= 0)dj1 = 0;
if (GetKeyState(VK_UP) >= 0)dj2 = 0;
if (GetKeyState('K') >= 0)s11 = 0;
if (GetKeyState('L') >= 0)s12 = 0;
if (GetKeyState('2') >= 0)s21 = 0;
if (GetKeyState('3') >= 0)s22 = 0;
if (skill1[0] == 2)s11 = 1;
if (skill1[1] == 2)s12 = 1;
if (skill2[0] == 2)s21 = 1;
if (skill2[1] == 2)s22 = 1;
if ((!p1.flying)&&(!p1.loving)) {
if (dj1 == 0 && GetKeyState('W') < 0 && (p1.jh <= jumph || ((skill1[0] == -1 || skill1[1] == -1) && p1.jh <= 2 * jumph))) {
dj1 = 1;
if ((skill1[0] == -1 || skill1[1] == -1) && p1.jh >= 2 * jumph && !p1.fly)p1.jh = 3 * jumph;
else if (p1.jh >= jumph && !p1.fly)p1.jh = 2 * jumph;
else p1.jh = p1.j + jumph;
p1.fly = 0;
p1.jump();
}
if (GetKeyState('A') < 0 && p1.x > 1) {
p1.move(1);
}
if (GetKeyState('D') < 0 && p1.x < 188) {
p1.move(2);
}
if (!p1.gaying) {
if (GetKeyState('J') < 0 && da1 == 0) {
da1 = 6;
p1.attack();
}
if (GetKeyState('K') < 0 && s11 == 0) {
s11 = 1;
p1.skill(skill1[0], 0);
}
if (GetKeyState('L') < 0 && s12 == 0) {
s12 = 1;
p1.skill(skill1[1], 1);
}
}
}
if ((!p2.flying)&&(!p2.loving)) {
if (!p2.gaying) {
if (GetKeyState('1') < 0 && da2 == 0) {
da2 = 6;
p2.attack();
}
if (GetKeyState('2') < 0 && s21 == 0) {
s21 = 1;
p2.skill(skill2[0], 0);
}
if (GetKeyState('3') < 0 && s22 == 0) {
s22 = 1;
p2.skill(skill2[1], 1);
}
}
if (dj2 == 0 && GetKeyState(VK_UP) < 0 && (p2.jh <= jumph || ((skill2[0] == -1 || skill2[1] == -1) && p2.jh <= 2 * jumph))) {
dj2 = 1;
if ((skill2[0] == -1 || skill2[1] == -1) && p2.jh >= 2 * jumph && !p2.fly)p2.jh = 3 * jumph;
else if (p2.jh >= jumph && !p2.fly)p2.jh = 2 * jumph;
else p2.jh = p2.j + jumph;
p2.fly = 0;
p2.jump();
}
if (GetKeyState(VK_LEFT) < 0 && p2.x > 1) {
p2.move(1);
}
if (GetKeyState(VK_RIGHT) < 0 && p2.x < 188) {
p2.move(2);
}
}
}
void BoomGet() {
if ((!p1.flying)&&(!p1.loving)&&(!p1.gaying)) {
if (skill1[0] == 2 && cool[0][0] <= 0) {
if (GetKeyState('K') < 0)++boom1;
if (boom1 > 30 || (GetKeyState('K') >= 0 && boom1)) {
p1.skill(2, 0);
boom1 = 0;
}
}
if (skill1[1] == 2 && cool[0][1] <= 0) {
if (GetKeyState('L') < 0)++boom1;
if (boom1 > 30 || (GetKeyState('L') >= 0 && boom1)) {
p1.skill(2, 1);
boom1 = 0;
}
}
}
if (p2.flying||p2.loving||p2.gaying)return;
if (skill2[0] == 2&&cool[1][0]<=0) {
if (GetKeyState('2') < 0)++boom2;
if (boom2 > 30 || (GetKeyState('2') >= 0 && boom2)) {
p2.skill(2,0);
boom2 = 0;
}
}
if (skill2[1] == 2&&cool[1][1]<=0) {
if (GetKeyState('3') < 0)++boom2;
if (boom2 > 30 || (GetKeyState('3') >= 0 && boom2)) {
p2.skill(2,1);
boom2 = 0;
}
}
}
void mapprint() {
for (int i = 1; i <= 188; ++i)
cout << " ";
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), BACKGROUND_BLUE | BACKGROUND_INTENSITY);
for (int i = 1; i <= 80; ++i)
cout << " ";
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_BLUE | FOREGROUND_INTENSITY | BACKGROUND_INTENSITY | BACKGROUND_GREEN | BACKGROUND_BLUE);
cout << " player1 ";
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), BACKGROUND_BLUE | BACKGROUND_GREEN | BACKGROUND_INTENSITY);
cout << "?§";
Setcolor(1);
cout << " player2 ";
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), BACKGROUND_RED | BACKGROUND_INTENSITY);
for (int i = 1; i <= 80; ++i)
cout << " ";
go(1, 42);
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), BACKGROUND_BLUE | BACKGROUND_GREEN | BACKGROUND_INTENSITY);
for (int i = 1; i <= 188; ++i)
cout << (char)22;
Backcolor(1);
go(20-name1.size()/2, 44);
cout << name1;
go(8, 46);
cout << "技能一: ";
_skillprint(0, 0);
go(8, 48);
cout << "技能二: ";
_skillprint(0, 1);
Setcolor(1);
go(160-name2.size()/2, 44);
cout << name2;
go(145, 46);
cout << "技能一: ";
_skillprint(1, 0);
go(145, 48);
cout << "技能二: ";
_skillprint(1, 1);
Backcolor(1);
}
void _skillprint(int a,int b) {
if (!a) {
if (!b) {
if (skill1[0] == 1)cout << "闪现 0.0 s";
else if (skill1[0] == 2)cout << "手雷 0.0 s";
else if (skill1[0] == 3)cout << "魅惑 0.0 s";
else if (skill1[0] == 4)cout << "捡肥皂 0.0 s";
else if (skill1[0] == -1)cout << "三段跳 -";
else if (skill1[0] == -2)cout << "弹射 -";
} else {
if (skill1[1] == 1)cout << "闪现 0.0 s";
else if (skill1[1] == 2)cout << "手雷 0.0 s";
else if (skill1[1] == 3)cout << "魅惑 0.0 s";
else if (skill1[1] == 4)cout << "捡肥皂 0.0 s";
else if (skill1[1] == -1)cout << "三段跳 -";
else if (skill1[1] == -2)cout << "弹射 -";
}
} else {
if (!b) {
if (skill2[0] == 1)cout << "闪现 0.0 s";
else if (skill2[0] == 2)cout << "手雷 0.0 s";
else if (skill2[0] == 3)cout << "魅惑 0.0 s";
else if (skill2[0] == 4)cout << "捡肥皂 0.0 s";
else if (skill2[0] == -1)cout << "三段跳 -";
else if (skill2[0] == -2)cout << "弹射 -";
} else {
if (skill2[1] == 1)cout << "闪现 0.0 s";
else if (skill2[1] == 2)cout << "手雷 0.0 s";
else if (skill2[1] == 3)cout << "魅惑 0.0 s";
else if (skill2[1] == 4)cout << "捡肥皂 0.0 s";
else if (skill2[1] == -1)cout << "三段跳 -";
else if (skill2[1] == -2)cout << "弹射 -";
}
}
}
void skillprint(int a, int b) {
if (!a) {
if (!b)go(27, 46);
else go(27, 48);
} else {
if (!b)go(164, 46);
else go(164, 48);
}
Setcolor(a);
printf("%.1f", cool[a][b]);
if (cool[a][b] < 9.9)cout << " ";
Backcolor(a);
}
void winprint(bool f) {
Sleep(1000);
system("cls");
string winner;
if (!f)winner = name1;
else winner = name2;
go(91 - winner.size() / 2, 20);
Setcolor(f);
cout << winner << " Win !";
Sleep(3000);
}
int main_f1() {
system("color B9");
movewindow();
system("mode con lines=60 cols=188");
start1();
HideCursor();
gamestart:
system("cls");
p1.a = 1;
p2.a = 2;
p1.b[0] = 17;
p1.b[1] = 16;
p2.b[0] = 17;
p2.b[1] = 16;
hit[0] = 14;
hit[1] = 36;
p1.x = 10;
p1.y = bottom-28;
p2.x = 160;
p2.y = bottom-28;
p1.j = 0;
p2.j = 0;
p1.life = 80;
p2.life = 80;
p1.fly = 1;
p2.fly = 1;
p1.flying = 0;
p2.flying = 0;
p1.gaying = 0;
p2.gaying = 0;
p1.myself = 0;
p2.myself = 1;
p1.dir = 1;
start2();
system("cls");
mapprint();
p1.print();
p2.print();
bool flag = 0;
float count=0;
int num = 0;
Sleep(500);
bool flying = 0;
while (p1.life > -1 && p2.life > -1) {
++count;
++num;
if (num >= 1000)num = 0;
if (da1)--da1;
if (da2)--da2;
if (p1.loving) {
--p1.loving;
if (num% 5 == 0) {
if (p1.x > p2.x)p1.move(1);
else p1.move(2);
}
if (!p1.loving)p1.print();
}
if (p2.loving) {
--p2.loving;
if (num % 5 == 0) {
if (p2.x > p1.x)p2.move(1);
else p2.move(2);
}
if (!p2.loving)p2.print();
}
if (p1.gaying)--p1.gaying;
if (p2.gaying)--p2.gaying;
if (p1.fly&& p1.y < bottom) {
p1.clear();
++p1.y;
p1.print();
}
if (p2.fly&& p2.y < bottom) {
p2.clear();
++p2.y;
p2.print();
}
if (p1.y == bottom) {
p1.jh = 0;
p1.fly = 0;
p1.j = 0;
flying = 1;
}
if (p2.y == bottom) {
p2.jh = 0;
p2.fly = 0;
p2.j = 0;
}
if (p1.j) {
if (!p1.fly)p1.jump();
else --p1.j;
}
if (p2.j) {
if (!p2.fly)p2.jump();
else --p2.j;
}
if (p1.flying)p1.flown();
if (p2.flying)p2.flown();
if(flying)Getmove();
if (count >= 2.5) {
count -= 2.5;
for (register int i = 0; i <= 1; ++i)
for (register int j = 0; j <= 1; ++j) {
if (cool[i][j] > 0) {
cool[i][j] -= 0.1;
if (cool[i][j] < 0)cool[i][j] = 0;
skillprint(i, j);
}
}
}
if (!flag&&p1.x == p2.x)flag = 1;
if (flag && (p1.x != p2.x || p1.y != p2.y)) {
flag = 0;
p1.print();
p2.print();
}
int strb = bu.size();
for (int i = 0; i < strb; ++i) {
if (bu[i].soap) {
if (bu[i].fly()) {
bu.erase(bu.begin() + i);
--i;
--strb;
break;
}
} else if (bu[i].boom || bu[i].love) {
if (bu[i].fly() || bu[i].fly()) {
bu.erase(bu.begin() + i);
--i;
--strb;
break;
}
} else if (bu[i].fly() || bu[i].fly()||bu[i].fly()) {
bu.erase(bu.begin() + i);
--i;
--strb;
break;
}
}
Sleep(40 - strb / 5);
}
winprint(p1.life < p2.life);
Sleep(2000);
return 0;
}
int sec=0;
int main_f2() { //主函数
system("cls");
srand(time(0));//设置随机数
int a[11][11],c[11],d[11];
bool isb[11][11],open[11][11];
for(int i=0; i<11; i++) { //初始化数据
for(int j=0; j<11; j++) {
isb[i][j]=0;
a[i][j]=0;
open[i][j]=0;
}
}
setbomb(isb,a,0,c,d,open);//设置炸弹
ingame(isb,a,open);//进入游戏
return 0;
}
void setbomb(bool a[11][11],int x[11][11],int n,int *c,int *d,bool op[11][11]) { //递归设置
int m=n;
if(n==10)return;
c[n]=rand()%9+1;//随机数1~9
d[n]=rand()%9+1;
for(int j=0; j<m; j++) { //去重
if(c[m]==c[j]&&d[m]==d[j]) {
setbomb(a,x,n,c,d,op);
return;
}
}
a[c[n]][d[n]]=1;//设置为雷
op[c[n]][d[n]]=1;//设置为打开,主要为了没有标雷也能胜利
x[c[n]+1][d[n]]++;
x[c[n]-1][d[n]]++;
x[c[n]+1][d[n]+1]++;
x[c[n]][d[n]+1]++;
x[c[n]-1][d[n]+1]++;
x[c[n]+1][d[n]-1]++;
x[c[n]][d[n]-1]++;
x[c[n]-1][d[n]-1]++;
setbomb(a,x,++n,c,d,op);
}
void printo(bool a[11][11],int x[11][11],bool op[11][11],bool utisb[11][11]) { //根据打开情况输出
cout<<"扫雷 1.3"<<endl;
cout<<"作者:future(6872915@qq.com)"<<endl;
for(int i=1; i<10; i++) {
for(int j=1; j<10; j++) {
if(op[i][j]) { //是否打开?
if(utisb[i][j])cout<<"! ";//玩家认为是炸弹则输出 !
else {
if(a[i][j])cout<<"# ";
else cout<<x[i][j]<<" ";
}//否则输出数字
} else cout<<"# ";
}
cout<<endl;
}
}
void ingame(bool a[11][11],int x[11][11],bool op[11][11]) { //进入游戏,胜利、失败都可重玩
int n,b,b_r=10;
bool utisb[11][11],checked[11][11];
string m;
for(int j=0; j<11; j++) { //初始化数据
for(int k=0; k<11; k++) {
utisb[j][k]=0;
checked[j][k]=0;
}
}
for(int i=0; i<11; i++)checked[0][i]=1; //最外层一圈设为1,使得不会访问到数组以外,例如 checked[-1][3]
for(int i=0; i<11; i++)checked[i][0]=1; //报错为3221225477
for(int i=0; i<11; i++)checked[10][i]=1;
for(int i=0; i<11; i++)checked[i][10]=1;
while(1) {
printo(a,x,op,utisb);
cout<<"请按x列、y行的格式输入。"<<endl<<"如果要打开一个格子,请在末尾输入一个空格和o。\n如果要标记一个格子是雷,请在末尾输入一个空格和b。\n如果要打开一个格子周围一圈除了已标雷的所有雷,请在末尾输入一个空格和ao。\n"<<endl;
cout<<"现在还有"<<b_r<<"颗雷。"<<endl;
cin>>b>>n>>m;
if(m=="o") { //打开
utisb[n][b]=0;
op[n][b]=1;
checked[n][b]=1;
if(a[n][b]) {
system("cls");
for(int i=1; i<10; i++) {
for(int j=1; j<10; j++) {
if(a[i][j]) {
cout<<"* ";
} else {
cout<<x[i][j]<<" ";
}
}
cout<<endl;
}
cout<<"诶呦!"<<endl<<"爆炸了!"<<endl;
cout<<"Game over!"<<endl<<"还要再玩一局吗?"<<endl;
cout<<"感谢游玩。\n你在第"<<clock()/CLOCKS_PER_SEC-sec<<"秒时输了。";
cout<<"如果还要玩一局,请输入a,"<<endl<<"退出请输入o。"<<endl;
char c_c;
cin>>c_c;
sec=clock()/CLOCKS_PER_SEC;
if(c_c=='a')main_f2();
else return;
return;
} else {
if(x[n][b]==0) {
checked[n][b]=1;
search(n,b,op,x,checked,a);
}
}
} else { //标雷
if(m=="b") {
utisb[n][b]=1;
op[n][b]=1;
b_r--;
} else {
if(m=="ao") {
op[n+1][b]=1;
checked[n+1][b]=1;
if(x[n+1][b]==0) {
checked[n+1][b]=1;
search(n+1,b,op,x,checked,a);
}
op[n-1][b]=1;
checked[n-1][b]=1;
if(x[n-1][b]==0) {
checked[n-1][b]=1;
search(n-1,b,op,x,checked,a);
}
op[n+1][b+1]=1;
checked[n+1][b+1]=1;
if(x[n+1][b+1]==0) {
checked[n+1][b+1]=1;
search(n+1,b+1,op,x,checked,a);
}
op[n][b+1]=1;
checked[n][b+1]=1;
if(x[n][b+1]==0) {
checked[n][b+1]=1;
search(n,b+1,op,x,checked,a);
}
op[n-1][b+1]=1;
checked[n-1][b+1]=1;
if(x[n-1][b+1]==0) {
checked[n-1][b+1]=1;
search(n-1,b+1,op,x,checked,a);
}
op[n+1][b-1]=1;
checked[n+1][b-1]=1;
if(x[n+1][b-1]==0) {
checked[n+1][b-1]=1;
search(n+1,b-1,op,x,checked,a);
}
op[n][b-1]=1;
checked[n][b-1]=1;
if(x[n][b-1]==0) {
checked[n][b-1]=1;
search(n,b-1,op,x,checked,a);
}
op[n-1][b-1]=1;
checked[n-1][b-1]=1;
if(x[n-1][b-1]==0) {
checked[n-1][b-1]=1;
search(n-1,b-1,op,x,checked,a);
}
if((a[n+1][b]&&utisb[n+1][b]==0)||(a[n-1][b]&&utisb[n-1][b]==0)||(a[n+1][b+1]&&utisb[n+1][b+1]==0)||(a[n][b+1]&&utisb[n][b+1]==0)||(a[n-1][b+1]&&utisb[n-1][b+1]==0)||(a[n+1][b-1]&&utisb[n+1][b-1]==0)||(a[n][b-1]&&utisb[n][b-1]==0)||(a[n-1][b-1]&&utisb[n-1][b-1]==0)) {
system("cls");
for(int i=1; i<10; i++) {
for(int j=1; j<10; j++) {
if(a[i][j]) {
cout<<"* ";
} else {
cout<<x[i][j]<<" ";
}
}
cout<<endl;
}
cout<<"诶呦!"<<endl<<"爆炸了!"<<endl;
cout<<"Game over!"<<endl<<"还要再玩一局吗?"<<endl;
cout<<"感谢游玩。\n你在第"<<clock()/CLOCKS_PER_SEC-sec<<"秒时输了。";
cout<<"如果还要玩一局,请输入a,"<<endl<<"退出请输入o。"<<endl;
char c_c;
cin>>c_c;
sec=clock()/CLOCKS_PER_SEC;
if(c_c=='a')main_f2();
else return;
return;
}
}
}
}
int xxx=1;
for(int i=1; i<10; i++) { //查看是否胜利
for(int j=1; j<10; j++) {
xxx*=2*op[i][j]/2;
}
}
if(xxx) {
system("cls");
printo(a,x,op,utisb);
cout<<"你赢了!"<<endl;
cout<<"感谢游玩。\n你用了"<<clock()/CLOCKS_PER_SEC-sec<<"秒。";
cout<<"如果还要玩一局,请输入a,"<<endl<<"退出请输入o。"<<endl;
char c_c;
cin>>c_c;
sec=clock()/CLOCKS_PER_SEC;
if(c_c=='a')main_f2();
else return;
return;
}
system("cls");
}
}
void search(int n,int b,bool op[11][11],int a[11][11],bool checked[11][11],bool zxc[11][11]) { //如果点到空,继续查找的函数
if(zxc[n][b])return ;
done_searching(n-1,b,op,a,checked,zxc);
done_searching(n+1,b,op,a,checked,zxc);
done_searching(n+1,b+1,op,a,checked,zxc);
done_searching(n,b+1,op,a,checked,zxc);
done_searching(n-1,b+1,op,a,checked,zxc);
done_searching(n+1,b-1,op,a,checked,zxc);
done_searching(n,b-1,op,a,checked,zxc);
done_searching(n-1,b-1,op,a,checked,zxc);
}
void done_searching(int n,int b,bool op[11][11],int a[11][11],bool checked[11][11],bool zxc[11][11]) {
if(a[n][b]==0) {
if(checked[n][b]==0) {
op[n][b]=1;
checked[n][b]=1;
search(n,b,op,a,checked,zxc);
}
} else {
op[n][b]=1;
checked[n][b]=1;
}
}
int main_f3() {
//开头
cout<<" "<<"你";
Sleep(500);
cout<<" 的";
Sleep(500);
cout<<" 世";
Sleep(500);
cout<<" 界";
Sleep(1000);
cout<<endl<<" 作者:";
Sleep(500);
cout<<"黄";
Sleep(500);
cout<<"大";
Sleep(500);
cout<<"帅!";
cout<<endl<<" d---单人 s---双人"<<endl;
string a;
cin>>a;
if(a=="s")
cout<<"只有你一个人,无法联机!";
else if(a=="d") {
cout<<endl<<"相传世界由2名创世神所创造。一个叫Notch,一个叫Herobring。";
cout<<"他们是一对兄弟。";
Sleep(1000);
cout<<endl<<endl<<"他们创造出了人类。Notch总是创造出对人类有益的东西,";
cout<<"可Herobring相反。";
Sleep(1000);
cout<<endl<<endl<<"有一天,Herobring与Notch大战了一场,Herobring被Notch";
cout<<"的铁傀儡击杀了。Herobring死前发誓要复仇。";
Sleep(1000);
cout<<endl<<endl<<"可是,当大家都很高兴的时候,Notch找到你,对你说:";
Sleep(1000);
cout<<endl<<endl<<"“Him的创世之力不会被轻易消灭,总有一天,他会苏醒的!”";
Sleep(1000);
cout<<endl<<endl<<"苍老的Notch说完话,便倒下了。";
Sleep(1000);
cout<<endl<<endl<<endl<<endl<<"一场新的故事,拉开了序幕...";
string name;
cout<<endl<<endl<<"你的名字:";
cin>>name;
int a,b,c,him=0,xue=500,gong=15,ji=1,jin=0,hxue=1000;
int xue1=100,xue2=200,xue3=400,xue4=400,xue5=700,xue6=800,money=0;//开头结束
while(him!=1) { //主程序
cout<<endl<<"1--冒险 2--商店 3--状态 ";
cin>>a;
if(a==1) { //冒险
cout<<endl<<"1--僵尸森林 2--骷髅大陆 3--女巫沼泽 4--末影宫殿 ";
cout<<"5--守卫之洋 6--林地府邸 7--herobring的封印";
cin>>b;
if(b==1) { //打僵尸
while(xue1>0) {
cout<<endl<<"僵尸向你扑来!";
cout<<endl<<"是否攻击/逃跑?(1/2)";
cin>>c;
if(c==1) {
xue1-=gong;
cout<<endl<<"僵尸克了"<<gong<<"滴血";
if(xue1>0) {
cout<<endl<<"僵尸还有"<<xue1<<"滴血";
cout<<endl<<"僵尸咬了你!你克了10滴血";
xue-=10;
cout<<endl<<"你还有"<<xue<<"滴血";
} else
cout<<endl<<"僵尸挂菜!";
} else if(c==2) {
xue-=50;
cout<<endl<<"逃跑失败!克50滴血 ";
cout<<endl<<"你还有"<<xue<<"滴血";
}
if(xue<=0) {
cout<<endl<<"你死了!";
return 0;
}
}
cout<<endl<<"打败僵尸,经验加10点!获得50元。";
jin+=10;
xue1=100;
money+=50;
while(jin>=50) {
jin-=50;
ji+=1;
cout<<endl<<name<<"升级!";
gong+=2;
xue+=20;
}
}//打僵尸结束
if(b==2) { //打骷髅
while(xue2>0) {
cout<<endl<<"骷髅拿起了弓!";
cout<<endl<<"是否攻击/逃跑?(1/2)";
cin>>c;
if(c==1) {
xue2-=gong;
cout<<endl<<"骷髅克了"<<gong<<"滴血";
if(xue2>0) {
cout<<endl<<"骷髅还有"<<xue2<<"滴血";
cout<<endl<<"你被射中了!你克了20滴血";
xue-=20;
cout<<endl<<"你还有"<<xue<<"滴血";
} else
cout<<endl<<"骷髅挂菜!";
} else if(c==2) {
xue-=50;
cout<<endl<<"逃跑失败!克50滴血 ";
cout<<endl<<"你还有"<<xue<<"滴血";
}
if(xue<=0) {
cout<<endl<<"你死了!";
return 0;
}
}
cout<<endl<<"打败骷髅,经验加20点!获得100元";
jin+=20;
xue2=200;
money+=100;
while(jin>=50) {
jin-=50;
ji+=1;
cout<<endl<<name<<"升级!";
gong+=2;
xue+=20;
}
}//打骷髅结束
if(b==3) { //打女巫
while(xue3>0) {
cout<<endl<<"女巫丢出了药水!";
cout<<endl<<"是否攻击/逃跑?(1/2)";
cin>>c;
if(c==1) {
xue3-=gong;
cout<<endl<<"女巫克了"<<gong<<"滴血";
if(xue3>0) {
cout<<endl<<"女巫还有"<<xue3<<"滴血";
cout<<endl<<"你被药水砸中了!你克了50滴血";
xue-=50;
cout<<endl<<"你还有"<<xue<<"滴血";
} else
cout<<endl<<"女巫挂菜!";
} else if(c==2) {
xue-=50;
cout<<endl<<"逃跑失败!克50滴血 ";
cout<<endl<<"你还有"<<xue<<"滴血";
}
if(xue<=0) {
cout<<endl<<"你死了!";
return 0;
}
}
cout<<endl<<"打败女巫,经验加50点!获得250元(这数字很像你)";
jin+=50;
xue3=400;
money+=250;
while(jin>=50) {
jin-=50;
ji+=1;
cout<<endl<<name<<"升级!";
gong+=2;
xue+=20;
}
}//打女巫结束
if(b==4) { //打末影人
while(xue4>0) {
cout<<endl<<"你看见了末影人的眼睛!";
cout<<endl<<"是否攻击/逃跑?(1/2)";
cin>>c;
if(c==1) {
xue4-=gong;
cout<<endl<<"末影人克了"<<gong<<"滴血";
if(xue4>0) {
cout<<endl<<"末影人还有"<<xue4<<"滴血";
cout<<endl<<"你被末影人攻击了!你克了80滴血";
xue-=80;
cout<<endl<<"你还有"<<xue<<"滴血";
} else
cout<<endl<<"末影人挂菜!";
} else if(c==2) {
xue-=50;
cout<<endl<<"逃跑失败!克50滴血 ";
cout<<endl<<"你还有"<<xue<<"滴血";
}
if(xue<=0) {
cout<<endl<<"你死了!";
return 0;
}
}
cout<<endl<<"打败末影人,经验加80点!获得400元";
jin+=80;
xue4=100;
money+=400;
while(jin>=50) {
jin-=50;
ji+=1;
cout<<endl<<name<<"升级!";
gong+=2;
xue+=20;
}
}//打末影人结束
if(b==5) { //打守卫者
while(xue5>0) {
cout<<endl<<"你被守卫者用光波链接了!";
cout<<endl<<"是否攻击/逃跑?(1/2)";
cin>>c;
if(c==1) {
xue5-=gong;
cout<<endl<<"守卫者克了"<<gong<<"滴血";
if(xue5>0) {
cout<<endl<<"守卫者还有"<<xue5<<"滴血";
cout<<endl<<"守卫者光波攻击成功!你克了150滴血";
xue-=150;
cout<<endl<<"你还有"<<xue<<"滴血";
} else
cout<<endl<<"守卫者挂菜!";
} else if(c==2) {
xue-=50;
cout<<endl<<"逃跑失败!克50滴血 ";
cout<<endl<<"你还有"<<xue<<"滴血";
}
if(xue<=0) {
cout<<endl<<"你死了!";
return 0;
}
}
cout<<endl<<"打败守卫者,经验加150点!获得750元";
jin+=150;
xue5=100;
money+=750;
while(jin>=50) {
jin-=50;
ji+=1;
cout<<endl<<name<<"升级!";
gong+=2;
xue+=20;
}
}//打守卫者结束
if(b==6) { //打卫道士
while(xue6>0) {
cout<<endl<<"卫道士拿出一把大斧头!";
cout<<endl<<"是否攻击/逃跑?(1/2)";
cin>>c;
if(c==1) {
xue6-=gong;
cout<<endl<<"卫道士克了"<<gong<<"滴血";
if(xue6>0) {
cout<<endl<<"卫道士还有"<<xue6<<"滴血";
cout<<endl<<"卫道士狠狠砍了你一斧!你克了300滴血";
xue-=300;
cout<<endl<<"你还有"<<xue<<"滴血";
} else
cout<<endl<<"卫道士挂菜!";
} else if(c==2) {
xue-=50;
cout<<endl<<"逃跑失败!克50滴血 ";
cout<<endl<<"你还有"<<xue<<"滴血";
}
if(xue<=0) {
cout<<endl<<"你死了!";
return 0;
}
}
cout<<endl<<"打败卫道士,经验加300点!获得1500元";
jin+=300;
xue6=100;
money+=1500;
while(jin>=50) {
jin-=50;
ji+=1;
cout<<endl<<name<<"升级!";
gong+=2;
xue+=20;
}
}//打卫道士结束
if(b==7) { //打Him
cout<<"确定?(1/2)";
cin>>b;
if(b==1) {
cout<<"天地间一声大响,Him出现了!"<<endl;
cout<<"“你就是Notch的传承人?!不堪一击!”";
while(hxue>0) {
cout<<endl<<"Him冲了过来!";
cout<<endl<<"是否攻击/逃跑?(1/2)";
cin>>c;
if(c==1) {
hxue-=gong;
cout<<endl<<"Him克了"<<gong<<"滴血";
if(hxue>0) {
cout<<endl<<"Him还有"<<hxue<<"滴血";
cout<<endl<<"你被Him打中了!你克了500滴血";
xue-=500;
if(xue<=0) {
cout<<endl<<"你死了!";
return 0;
} else
cout<<endl<<"你还有"<<xue<<"滴血";
} else
cout<<endl<<"Him死了!";
} else if(c==2) {
xue-=50;
cout<<endl<<"逃跑失败!克50滴血 ";
cout<<endl<<"你还有"<<xue<<"滴血";
}
}
cout<<endl<<"你击杀了Him,你成了大英雄!";
him+=1;
}//打Him结束
}
}//冒险结束
if(a==2) { //商店
cout<<endl<<"你有"<<money<<"元";
cout<<endl<<"1--河豚10元(建议不要买) 2--治疗药水(瞬间治疗)30元 3--治疗药水(瞬间治疗2)50元 4--退出";
cin>>b;
if(b==1) {
if(money>=10) {
cout<<endl<<"不听帅哥言,吃亏在眼前!";
return 0;
} else
cout<<endl<<"钱不够!";
}
if(b==2) {
if(money>=30) {
money-=30;
xue+=100;
cout<<endl<<"购买成功!血加一百滴";
cout<<endl<<"你还有"<<xue<<"滴血";
} else
cout<<endl<<"钱不够!";
}
if(b==3) {
if(money>=50) {
money-=50;
xue+=200;
cout<<endl<<"购买成功!血加二百滴";
cout<<endl<<"你还有"<<xue<<"滴血";
} else
cout<<"钱不够!";
}
} //商店结束
if(a==3) { //显示状态
cout<<endl<<endl<<"血量"<<xue<<"滴"<<" 攻击"<<gong<<"点 ";
cout<<endl<<ji<<"级 "<<"还有"<<50-jin<<"点经验升级"<<" 还有"<<money<<"元"<<endl;
}//显示状态结束
}//主程序结束
cout<<endl<<"你赢了!";
} else cout<<" 乱输个毛!";
return 0;
}
void wait() {
Sleep(100);
user_input=getchar();
}
void cls() {
Sleep(100);
system("cls");
}
int main_f4() {
start:
cls();
goto a1;
gameover:
printf("游戏结束。");
printf("按回车键继续");
user_input=getchar();
if(user_input=13)
goto start;
a1:
printf("现在游戏开始。");
user_input=getchar();
printf("你住在山中的木屋里。");
wait();
printf("某天早上,你刚要出门,却发现不远处有一座从未见过的城堡。");
wait();
printf("出于好奇,你走近了它。");
wait();
goto a4;
a2:
printf("突然,方孔中射出无数支箭,你被射死了。");
wait();
printf("End01:城堡不喜欢没礼貌的孩子");
wait();
goto gameover;
a3:
cls();
printf("你又敲了三下门,门打开了。");
wait();
printf("门里面是一个略昏暗的大厅,墙壁上的火把提供了照明。");
wait();
printf("就在你慢步走进去时,门在你身后关上了。\n");
printf("1-试着打开门逃出去\n");
printf("2-继续前进");
s3:
wait();
switch(user_input) {
case '1':
goto a10;
case '2':
goto a13;
default:
goto s3;
}
a4:
cls();
printf("你来到城堡前。");
wait();
printf("城堡看起来很古老,古旧的红色木门紧关着。\n");
wait();
printf("1-推门进去\n");
printf("2-敲三下门试试\n");
printf("3-我不想进去了");
s4:
wait();
switch(user_input) {
case'1':
goto a8;
case'2':
goto a15;
case'3':
goto a16;
default:
goto s4;
}
a5:
printf("......");
wait();
printf("你用力拉把手,喀哒一声,门没有开,地面却崩塌了。");
wait();
printf("你掉了下去,在这下面满满的尖刺在等着你。");
wait();
printf("End03:城堡不喜欢胆小的孩子。");
wait();
goto gameover;
a6:
cls();
printf("你推开那扇门,里面是一个小房间.");
wait();
printf("墙壁上插着一支火把。");
wait();
printf("地上的阶梯似乎通向地下室.\n");
wait();
printf("1-从阶梯下去\n");
printf("2-先把火把丢下去");
s6:
wait();
switch(user_input) {
case '1':
goto a11;
case '2':
goto a12;
default:
goto s6;
}
a7:
printf("桌子上有一个金色的碗和银色的碗,里面都盛满了汤。\n");
wait();
printf("1-喝金碗里的汤\n");
printf("2-喝银碗里的汤\n");
printf("3-继续探索");
s7:
wait();
switch(user_input) {
case '1':
goto a17;
case'2':
goto a14;
case'3':
goto a19;
default:
goto s7;
}
a8:
cls();
printf("你推开门,门里是一间狭小的房屋,正对的墙上有很多方孔。\n");
wait();
goto a2;
a9:
system("cls");
printf("走廊的尽头是一个房间,你看到一张长长的餐桌。\n");
wait();
goto a7;
a10:
cls();
printf("你试图推门,推不开。");
wait();
printf("你看到门上的把手,想到了这门可能是要向后拉。");
wait();
goto a5;
a11:
cls();
printf("你走了下去,下面空荡荡的什么也没有。");
wait();
printf("在你感到呼吸困难的时候已经晚了。");
wait();
printf("你死于窒息。");
wait();
printf("End04:城堡不喜欢粗心的孩子。");
wait();
goto gameover;
a12:
cls();
aa=2;
printf("你把火把丢下去,火把很快熄灭了。");
wait();
printf("你庆幸你没有直接走下去,退回到了大厅。\n");
wait();
printf("1-走上台阶\n");
printf("2-去走廊");
s12:
wait();
switch(user_input) {
case '1':
goto a18;
case '2':
goto a9;
default:
goto s12;
}
a13:
cls();
printf("大厅里光线略有些昏暗。");
wait();
printf("你看到正对着你的是一扇门,在你的左边是螺旋向上的台阶,右边是一条走廊。\n");
wait();
printf("1-进入那扇门\n");
printf("2-走上台阶\n");
printf("3-去走廊那边看看");
s13:
wait();
switch(user_input) {
case '1':
goto a6;
case '2':
goto a18;
case '3':
goto a9;
default:
goto s13;
}
a14:
cls();
printf("你喝光了银碗里的汤,看到碗底刻着的字。");
printf("\n【厨房的橱柜下面】");
wait();
printf("你走向厨房.");
goto a20;
a15:
cls();
printf("你敲了三下门,门一点反应都没有。\n");
wait();
printf("1-再敲三下门\n");
printf("2-推门进去\n");
printf("3-不想进去了");
s15:
wait();
switch(user_input) {
case '1':
goto a3;
case '2':
goto a8;
case '3':
goto a16;
default:
goto s15;
}
a16:
cls();
printf("你并没有进入城堡,而是回到家中。");
wait();
printf("城堡持续存在了几天,在那之后,你发现城堡不见了。");
wait();
printf("你忘记了这座城堡曾经存在过,继续着原来的生活。");
wait();
printf("End02:城堡不喜欢没有冒险精神的孩子。");
wait();
goto gameover;
a17:
cls();
printf("你端起金碗,一饮而尽。");
wait();
printf("你很快就察觉到了腹中的异样,你中毒身亡。");
wait();
printf("End05:城堡不喜欢馋嘴的孩子。");
wait();
goto gameover;
a18:
cls();
printf("你走上楼梯,在你面前的是一条过道。");
wait();
printf("左边是一扇双开的门,右边是一扇单开的门。\n");
wait();
printf("1-进入双开的门\n");
printf("2-进入单开的门\n");
printf("3-沿着这条走廊向前走");
s18:
wait();
switch(user_input) {
case '1':
goto a26;
case '2':
goto a27;
case '3':
goto a28;
default:
goto s18;
}
a19:
cls();
printf("你发现这房间的尽头通向近似厨房的房间。");
wait();
printf("你进去搜索了一圈,一无所获。");
wait();
printf("于是你回到了大厅。\n");
wait();
printf("1-去楼上\n");
if(aa==2)
printf("2-走进中间的房间(已探索)");
else
printf("2-走进中间的房间");
s19:
wait();
switch(user_input) {
case '1':
goto a18;
case '2':
goto a19s;
default:
goto s19;
}
a19s:
if(aa==2) {
printf("由于那里的地下室过于危险,你还是决定上楼。");
wait();
goto a18;
} else
goto a6;
a20:
printf("你来回走了两圈,找到了厨房。");
wait();
printf("你望向橱柜下方,找到了一封信。\n");
b=1;
wait();
printf("1-拆开看看\n");
printf("2-就这样回到大厅并上楼\n");
if(aa==2)
printf("3-走进大厅中间的房间(已探索)");
else
printf("3-走进大厅中间的房间");
s20:
wait();
switch(user_input) {
case '1':
goto a25;
case '2':
goto a18;
case '3':
goto a19s;
default:
goto s20;
}
a21:
cls();
printf("你拿起《魔法入门》。");
wait();
printf("里面都是奇怪的符号,看不懂。");
wait();
goto a29;
a22:
cls();
printf("你把《机关》从书架抽出来。");
wait();
printf("...");
wait();
printf("突然,书架向你倒了下来。");
wait();
printf("你被压在了下面。");
wait();
printf("你的头被砸出血了,临死大呼:“果然是机关啊!”");
wait();
printf("End07:城堡不喜欢投机取巧的孩子。");
wait();
goto gameover;
a23:
cls();
printf("你翻开《城堡常识》。");
wait();
printf("书上说这城堡是有灵性的,还有一系列对城堡主人的介绍。");
wait();
d=1;
goto a29;
a24:
cls();
printf("你翻开那本书,书中奇怪的图案令你感到不适。");
wait();
printf("你的心脏剧烈地跳动,你死了。");
wait();
printf("End08:城堡不喜欢不听劝告的孩子。");
wait();
goto gameover;
a25:
cls();
printf("你拆开信封,里面一股粉尘使你不停咳嗽。");
wait();
printf("里面的纸条写着:您订购的毒粉,请验收。");
wait();
printf("End06:城堡不喜欢窥探隐私的孩子。");
wait();
goto gameover;
a26:
cls();
printf("你推开了门,这个房间看起来像一个藏书室。");
wait();
printf("面很多书架平行地摆放着,每个书架上的书看起来是一样的。");
wait();
printf("你擦了擦书脊上的灰尘,勉强看清了书名。");
wait();
goto a29;
a27:
cls();
printf("你打开了那扇门。");
wait();
printf("门里的房间很小,桌子上一个玻璃沙漏中燃烧着火焰。");
wait();
printf("周围是大大小小的试管,烧瓶,里面装着各种颜色的液体。");
wait();
printf("这时,一只老鼠出现在你的视野,它感受到了你的存在,一扭头逃走了。");
wait();
printf("但是,它的动作碰倒了一个塞住的绿色瓶子。\n");
wait();
printf("1-把瓶子扶起来\n");
printf(""2-不管它");
s27:
wait();
switch(user_input) {
case '1':
goto a30;
case '2':
goto a31;
default:
goto s27;
}
a28:
cls();
printf("你来到了走廊的尽头");
wait();
goto a32;
a29:
cls();
printf("你要阅读哪本书?\n");
wait();
printf("1-《魔法入门》\n");
printf("2-《机关》\n");
printf("3-《城堡常识》\n");
printf("4-《千万别读这个》\n");
printf("5-算了");
s29:
wait();
switch(user_input) {
case '1':
goto a21;
case '2':
goto a22;
case '3':
goto a23;
case '4':
goto a24;
case '5':
goto a2a;
default:
goto s29;
}
a2a:
cls();
printf("要去哪里?\n");
wait();
printf("1-对面单开门的房间\n");
printf("2-沿走廊走下去");
s2a:
wait();
switch(user_input) {
case '1':
goto a27;
case '2':
goto a28;
default:
goto s2a;
}
a30:
cls();
printf("你一把抓住这个瓶子。");
wait();
printf("瓶子里装满了绿色液体,标签上写着易爆物品。");
wait();
c=1;
printf("你决定拿着它。");
wait();
printf("现在要去哪里?\n");
wait();
printf("1-对面那扇双开的门\n");
printf("2-走向走廊的深处");
s30:
wait();
switch(user_input) {
case '1':
goto a26;
case '2':
goto a28;
default:
goto s30;
}
a31:
cls();
printf("瓶子慢慢滚到桌子边缘,然后摔在地上。");
wait();
printf("瓶子里的是不稳定物质,爆炸并引起了连锁反应。");
wait();
printf("你被炸死了。");
wait();
printf("End09:城堡不喜欢冷漠的孩子。");
wait();
goto gameover;
a32:
cls();
printf("在你面前站着一副盔甲。");
wait();
printf("不知为什么,它自己动了起来。");
wait();
printf("它向你移动并试图用手里的剑把你杀死!\n");
wait();
printf("1-试着用拳头打它\n");
printf("2-尝试逃跑\n");
if(c==1)
printf("3-试着把易爆物质扔向它");
s32:
wait();
switch(user_input) {
case '1':
goto a43;
case '2':
goto a44;
case '3':
goto a32a;
default:
goto s32;
}
a32a:
if(c==1)
goto a42;
else
goto s32;
a33:
cls();
printf("走廊在这里向左转弯。");
wait();
printf("走过这个拐角向前,你看见你的左侧有一扇门,前方则是螺旋向上的楼梯。\n");
wait();
printf("1-进入那个房间\n");
printf("2-走上楼梯");
s33:
wait();
switch(user_input) {
case '1':
goto a40;
case '2':
goto a41;
default:
goto s33;
}
a34:
cls();
printf("你打开衣柜,里面一片漆黑。");
wait();
printf("这时,突然从里面走出一个骨瘦如柴的男子,缓缓走到床边坐下。");
wait();
if(b==1) {
printf("“有我的信?”他用沙哑的声音问。");
wait();
goto a47;
}
goto a38;
a35:
cls();
printf("床头柜里有两粒不知名的药丸。");
wait();
printf("出于戒备你并没有尝试");
wait();
goto a39;
a36:
cls();
printf("你站在镜子前。");
wait();
printf("你突然发现,镜子里的你是一具骷髅!");
wait();
printf("你受到了惊吓,连忙转过头去。");
wait();
goto a39;
a37:
cls();
printf("宝座的扶手上放着一顶镶嵌着宝石的金色王冠。\n");
wait();
printf("1-把它戴在头上\n");
printf("2-试着把它带回家\n");
printf("3-试着擦拭王冠");
s37:
wait();
switch(user_input) {
case '1':
goto a46;
case '2':
goto a48;
case '3':
goto a54;
default:
goto s37;
}
a38:
cls();
printf("他看到你,叹了一口气,回到了衣柜中。");
wait();
printf("你把柜门关上了。");
wait();
a39:
cls();
printf("你要翻看哪里?\n");
wait();
printf("1-衣柜\n");
printf("2-床头柜\n");
printf("3-梳妆镜\n");
printf("4-离开");
s39:
wait();
switch(user_input) {
case '1':
goto a34;
case '2':
goto a35;
case '3':
goto a36;
case '4':
goto a41;
default:
goto s39;
}
a40:
cls();
printf("你推开门,里面是一间卧室。");
wait();
printf("或许有什么值得寻找的东西?");
wait();
goto a39;
a41:
cls();
printf("]你走上台阶,来到三层。");
wait();
printf("正对你的是一扇红色金边的大门,你毫不犹豫地走了进去。");
wait();
goto a45;
a42:
cls();
printf("你掏出小瓶子丢向它。");
wait();
printf("......");
wait();
printf("轰——");
wait();
printf("它在一声爆炸后化作了无意义的废铁。");
wait();
printf("你越过这堆废铁继续前进");
wait();
goto a33;
a43:
cls();
printf("你用拳头砸向它,它毫发无损 C语言简易文字冒险游戏源代码_文库下载https://www.wenkuxiazai.com/doc/0d6314f1ee06eff9aff8076e-5.html ,你却感觉到拳头的疼痛。");
wait();
printf("它好像被激怒了,挥剑向你砍来。");
wait();
printf("你被砍死了。");
wait();
printf("End10:城堡不喜欢自不量力的孩子。");
wait();
goto gameover;
a44:
cls();
printf("你不顾一切地逃到大厅,跑到最开始的门口。");
wait();
goto a10;
a45:
cls();
printf("门里面长长的红地毯延伸出去,末端是一个装饰华丽的宝座。");
wait();
printf("你走近了它。");
wait();
goto a37;
a46:
cls();
printf("你把王冠戴在了头上。");
wait();
printf("这时,你突然发现你旁边还有一个人。");
wait();
printf("在你发现他的时候,他已经飞速地跑开了。\n");
wait();
printf("1-追上他\n");
printf("2-不管他");
s46:
wait();
switch(user_input) {
case '1':
goto a52;
case '2':
goto a53;
default:
goto s46;
}
a47:
cls();
printf("你把信塞给他。");
wait();
printf("他看到信点了点头,对你念了一堆不知所云的咒语就回到衣柜里了。");
wait();
printf("你决定上楼。");
wait();
goto a50;
a48:
cls();
printf("你拿着王冠,跑到城堡的大门处。");
wait();
printf("你试着推门,门纹丝不动。");
wait();
printf("这时,你听到轰隆隆的响声。");
wait();
printf("回头一看,那盔甲重新组合起来了。");
wait();
printf("它一剑劈中了你。");
wait();
printf("End11:城堡不喜欢贪财的孩子。");
wait();
goto gameover;
a49:
cls();
printf("他告诉你他就是城堡的主人。");
wait();
printf("他还告诉了你这城堡的诅咒:");
wait();
printf("一旦戴上王冠就会成为城堡的主人,在下一个访客来到这里之前,是无法走出城堡的。");
wait();
printf("如果你戴上了王冠,他就会得到解放。\n");
wait();
printf("1-我想戴上王冠,解开他的束缚。\n");
printf("2-我要尝试打破这个诅咒,即使付出生命的代价。");
s49:
wait();
switch(user_input) {
case '1':
goto a53;
case '2':
goto a61;
default:
goto s49;
}
a50:
cls();
printf("你跑上楼梯,正对着你的是一扇红色金边的大门。");
wait();
printf("你毫不犹豫走了进去。");
goto a55;
a51:
cls();
printf("你快步来到二楼,进入了藏书室。");
wait();
if(d=1)
goto a56;
else
goto a57;
a52:
cls();
printf("你试图追上他,可惜他跑得飞快,很快就从大门冲出去了。");
wait();
printf("你再想出去,发现大门又关得紧紧的。");
wait();
printf("无奈之中你不知道接下来该做什么。");
wait();
printf("不过王冠似乎在指引你去二楼那个双开门的房间,也就是藏书室。");
wait();
goto a51;
a53:
cls();
printf("你坐在宝座上。");
wait();
printf("不知为何王冠似乎在指引你去二楼那个双开门的房间,也就是藏书室。");
wait();
goto a51;
a54:
cls();
printf("你用袖子擦拭了几下王冠,王冠上的宝石闪了一下。");
wait();
printf("这时,你脑内传来声音:你可以离开了。\n");
wait();
printf("1-戴上王冠\n");
printf("2-离开城堡");
s54:
wait();
switch(user_input) {
case '1':
goto a46;
case '2':
goto a60;
default:
goto s54;
}
a55:
cls();
printf("在大门里,一条长长的红地毯通向前方.");
wait();
printf("红地毯的尽头是装饰华美的宝座,宝座上有一个人。");
wait();
printf("他见到你,很快站了起来。");
wait();
printf("你向他打招呼,他很诧异你能够看到他。");
wait();
printf("这时,你注意到了宝座上放着一顶镶嵌着宝石的金色王冠。\n");
wait();
printf("1-戴上王冠\n");
printf("2-把王冠带出城堡\n");
printf("3-试着擦拭王冠\n");
printf("和那个人交谈");
s55:
wait();
switch(user_input) {
case '1':
goto a46;
case '2':
goto a48;
case '3':
goto a54;
case '4':
goto a49;
default:
goto s55;
}
a56:
cls();
printf("你再次打开《城堡常识》。");
wait();
printf("发现上面的文字变得清晰了。");
wait();
printf("你开始阅读这本书。");
wait();
goto a58;
a57:
cls();
printf("你随手拿了一本书,书名叫《城堡常识》。"");
wait();
a58:
cls();
printf("书上说这城堡是遭受诅咒的城堡。");
wait();
printf("戴上王冠后将永远无法离开城堡或摘下王冠,并且来访者无法看到城堡主人。");
wait();
printf("到有人踏入了这座城堡才可以摘下王冠。");
wait();
printf("只有来访者戴上了王冠,上一任主人才可以走出城堡。");
wait();
a59:
cls();
printf("你又阅读了《魔法基础》,读得很顺利。");
wait();
printf("学会了如何控制这座城堡在空中飞翔。");
wait();
printf("你每天在这里过着奢华的生活,现在你就是城堡的主人。");
wait();
printf("很多年过去了,你已经驾驶城堡去了无数地方,但没有别人敢进入城堡。");
wait();
printf("End12:城堡喜欢孤独的孩子。");
wait();
goto gameover;
a60:
cls();
printf("你来到大门前,轻推大门,大门缓缓打开了。");
wait();
printf("你回到家,背后传来一声轻轻的叹息。");
wait();
printf("城堡存在了几天,然后悄无声息地消失了 。");
wait();
printf("你继续了平常的生活。");
wait();
printf("End13:城堡喜欢质洁的孩子。");
wait();
goto gameover;
a61:
cls();
printf("你把你的想法说给那个人听,他同意了,并提出了一个方案。");
wait();
printf("他带你来到二楼那个单开门的房间,那里储存着大量不稳定的魔法药剂。");
wait();
printf("你们将所有容器打开,将其中的液体倾倒满整个城堡。");
wait();
printf("最后,你把最后一只绿色的瓶子用力摔在地上。");
wait();
printf("瓶子引发了连锁反应,爆炸和火焰吞没了你们两个人。");
wait();
printf("城堡轰然倒塌,诅咒被打破了。");
wait();
printf("End14:城堡喜欢你。");
wait();
goto gameover;
return 0;
}
void Place(const int x, const int y) {
COORD PlaceCursorHere;
PlaceCursorHere.X = y;
PlaceCursorHere.Y = x;
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), PlaceCursorHere);
return;
}
void appear() {
for(i=3; i<=22; i++) for(j=1; j<=15; j++) if(a[i][j]!=0) {
Place(i-2,2*j);
printf("■");
}
}
void disappear() {
for(i=3; i<=22; i++) for(j=1; j<=15; j++) if(a[i][j]==2) {
Place(i-2,2*j);
printf(" ");
}
}
void ss() {
Place(9,39);
printf("%d",score);
if(score>=speed*70) {
speed++;
ti=ti-200;
if(ti<0) ti=0;
else {
for(i=1; i<=4; i++) {
Place(9,12);
printf("speed up!");
Sleep(70);
Place(9,12);
for(j=1; j<=9; j++) printf(" ");
Sleep(70);
}
Sleep(200);
}
}
appear();
Place(12,39);
printf("%d",speed);
}
void replace() {
for(i=1; i<=20; i++) for(j=2; j<=30; j++) {
Place(i,j);
printf(" ");
}
for(i=0; i<=22; i++) for(j=1; j<=15; j++) a[i][j]=0;
for(i=1; i<=15; i++) a[23][i]=1;
for(i=1; i<=23; i++) {
a[i][0]=1;
a[i][16]=1;
}
ss();
tim=800;
ti=800;
shape=0;
add=0;
score=0;
speed=1;
}
void change(int x) {
int q=0,l;
for(l=1; l<=x; l++) {
for(j=0; j<=2+add; j++) {
for(i=2+add; i>=0; i--) {
turn[j][q]=ta[i][j];
q++;
if(q>2+add) q=0;
}
}
for(i=0; i<=3; i++) for(j=0; j<=3; j++) ta[i][j]=turn[i][j];
}
}
void born() {
int x,q=0;
srand(time(NULL));
bn=v;
shape=nextshape;
x=rand()%12+1;
if(v==5&&x>1) {
x--;
add=1;
}
for(i=0; i<=2+add; i++) for(j=x; j<=x+2+add; j++) {
a[i][j]=nex[i][q];
q++;
if(q>2+add) q=0;
}
add=0;
}
void next() {
srand(time(NULL));
v=rand()%7;
nextshape=rand()%4;
add=0;
for(i=3; i<=6; i++) for(j=37; j<=45; j++) {
Place(i,j);
printf(" ");
}
for(i=0; i<=3; i++) for(j=0; j<=3; j++) nex[i][j]=turn[i][j]=ta[i][j]=0;
ta[1][1]=2;
if(v==0) ta[1][2]=ta[1][0]=ta[0][1]=2;
if(v==1) ta[1][2]=ta[1][0]=ta[0][0]=2;
if(v==2) ta[1][2]=ta[1][0]=ta[0][2]=2;
if(v==3) ta[1][0]=ta[0][1]=ta[0][2]=2;
if(v==4) ta[0][0]=ta[0][1]=ta[1][2]=2;
if(v==5) {
ta[1][0]=ta[1][2]=ta[1][3]=2;
add=1;
}
if(v==6) ta[0][0]=ta[0][1]=ta[1][0]=2;
if(nextshape>0&&v!=6) {
change(nextshape);
for(i=0; i<=3; i++) for(j=0; j<=3; j++) {
nex[i][j]=turn[i][j];
if(nex[i][j]==2) {
Place(i+3,j*2+37);
printf("■");
}
}
} else {
for(i=0; i<=3; i++) for(j=0; j<=3; j++) {
nex[i][j]=ta[i][j];
if(nex[i][j]==2) {
Place(i+3,j*2+37);
printf("■");
}
}
}
}
void clear() {
int c=0,f=0,l[23],s=0,k;
for(i=3; i<=22; i++) {
l[i]=0;
for(j=1; j<=15; j++) c=a[i][j]+c;
if(c==15) {
for(j=1; j<=15; j++) a[i][j]=0;
for(k=i-1; k>=2; k--) for(j=1; j<=15; j++) a[k+1][j]=a[k][j];
f++;
l[i]=1;
s=5;
}
c=0;
}
score=score+f*10;
while(f>1) {
score=score+f*5;
f--;
}
f=0;
while(s>0) {
for(i=22; i>=3; i--) if(l[i]==1) {
Place(i-2,2);
for(j=1; j<=15; j++) printf("■");
}
Sleep(70);
for(i=22; i>=3; i--) if(l[i]==1) {
Place(i-2,2);
for(j=1; j<=30; j++) printf(" ");
}
Sleep(70);
s--;
}
for(i=3; i<=22; i++) for(j=1; j<=15; j++) {
Place(i-2,2*j);
printf(" ");
}
appear();
}
void control() {
int up,down,right,left,c=0,d=0,x,y,no=0,k,l=0,q=0;
k=shape;
add=0;
up=GetAsyncKeyState(VK_UP);
down=GetAsyncKeyState(VK_DOWN);
right=GetAsyncKeyState(VK_RIGHT);
left=GetAsyncKeyState(VK_LEFT);
if(down!=0) {
Sleep(70);
tim=0;
}
if(left!=0||right!=0) {
Sleep(100);
disappear();
for(i=0; i<=22; i++) for(j=1; j<=15; j++) {
if(a[i][j]==2&&a[i][j-1]!=1) c++;
if(a[i][j]==2&&a[i][j+1]!=1) d++;
}
for(i=0; i<=22; i++) for(j=1; j<=15; j++) if(left!=0&&c==4&&a[i][j]==2) {
a[i][j-1]=a[i][j];
a[i][j]=0;
}
for(i=0; i<=22; i++) for(j=15; j>=1; j--) if(right!=0&&d==4&&a[i][j]==2) {
a[i][j+1]=a[i][j];
a[i][j]=0;
}
appear();
}
if(up!=0&&bn!=6) {
Sleep(150);
disappear();
for(i=0; i<=22; i++) {
for(j=1; j<=15; j++) if(a[i][j]==2) {
x=i;
no=1;
break;
}
if(no==1) break;
}
no=0;
for(j=1; j<=15; j++) {
for(i=0; i<=22; i++) if(a[i][j]==2) {
y=j;
no=1;
break;
}
if(no==1) break;
}
no=0;
if(k==1) y--;
if(k==2) x--;
add=0;
if(bn==5) {
add=1;
if(k==0||k==2) x--;
if(k==1||k==3) y--;
}
for(i=0; i<=3; i++) for(j=0; j<=3; j++) ta[i][j]=a[x+i][y+j];
if(bn>=0&&bn<5) {
if(k==0) ta[2][0]=0;
if(k==1) ta[0][0]=0;
if(k==2) ta[0][2]=0;
if(k==3) ta[2][2]=0;
}
if(bn==5) {
if(k==0) ta[0][3]=ta[2][0]=ta[2][1]=ta[3][1]=ta[3][0]=0;
if(k==1) ta[0][0]=ta[1][0]=ta[0][1]=ta[1][1]=ta[3][3]=0;
if(k==2) ta[3][0]=ta[0][2]=ta[0][3]=ta[1][2]=ta[1][3]=0;
if(k==3) ta[0][0]=ta[2][2]=ta[2][3]=ta[3][2]=ta[3][3]=0;
}
for(i=0; i<=2+add; i++) for(j=0; j<=2+add; j++) if(ta[i][j]!=1) l++;
if(l==9+add*7) {
change(1);
for(i=0; i<=22; i++) for(j=1; j<=15; j++) if(a[i][j]==2) a[i][j]=0;
for(i=0; i<=2+add; i++) for(j=0; j<=2+add; j++) if(turn[i][j]==2) a[x+i][y+j]=turn[i][j];
shape++;
}
if(shape>3) shape=0;
appear();
}
}
int main_f5() {
int x,k,start,finish,d,k1,ok=1;
srand(time(NULL));
x=rand()%9+3;
k1=rand()%4;
printf("┌");
for(i=1; i<=15; i++) printf("┄");
printf("┐\n");
for(i=1; i<=20; i++) printf("┆\n");
printf("└");
for(i=1; i<=15; i++) printf("┄");
printf("┘");
for(i=1; i<=20; i++) {
Place(i,32);
printf("┆\n");
}
Place(2,37);
printf("NEXT");
Place(8,37);
printf("SCORE");
Place(11,37);
printf("SPEED");
Place(9,6);
printf("Press ENTER to start");
while(ok!=0) {
if(GetAsyncKeyState(VK_RETURN)) ok=0;
}
while(ok==0) {
replace();
next();
while(1) {
born();
next();
while(1) {
appear();
k=0;
start=clock();
while(1) {
finish=clock();
d=finish-start;
if(d>=tim) break;
control();
}
disappear();
for(i=22; i>=0; i--) for(j=1; j<=15; j++) if(a[i][j]==2&&a[i+1][j]!=1) k++;
if(k==4) {
for(i=22; i>=0; i--) for(j=1; j<=15; j++) if(a[i][j]==2) {
a[i+1][j]=2;
a[i][j]=0;
}
} else {
for(i=22; i>=0; i--) for(j=1; j<=15; j++) if(a[i][j]==2) a[i][j]=1;
break;
}
tim=ti;
appear();
if(GetAsyncKeyState(VK_ESCAPE)) exit(0);
}
appear();
clear();
for(i=1; i<=15; i++) if(a[2][i]==1) {
ok=1;
break;
}
if(ok==1) break;
ss();
if(GetAsyncKeyState(VK_ESCAPE)) exit(0);
}
for(i=1; i<=20; i++) for(j=2; j<=30; j++) {
Place(i,j);
printf(" ");
}
Place(9,12);
printf("GAME OVER!");
Sleep(800);
Place(10,5);
printf("TRY AGAIN?(yes=0 no=1) ");
scanf("%d",&ok);
}
return 0;
}
int main_f6() {
char name[100];
int za=0,zb=0,zc=0,zd=0,ze=0,zf=0,ga=0,gb=0,gc=0,gd=0,ge=0,gf=0,i,a,b,c,d,e,f,g,h,jy=0,dj=0,mj,bb,cc,aa=5,jm=0,jb=0,jq=0,js=0,jj=0,ij=1,mb=0,da,egg=0,bmh=0;
int jsl=0,zj,ngmb=0,nn=0,nsl=0,nq=0,jya=20,td=1,qqq,qq=50,qj;
long int ma,jinbi=20;
cout<<"欢迎来到你的庄园!"<<endl;
cout<<"作者:GYF123"<<endl;
cout<<"伪劣必究!!!"<<endl;
Sleep(1000);
cout<<"请输入庄园的名字:"<<endl;
gets(name);
cout<<"你的庄园就叫"<<name<<"了。"<<endl;
cout<<"正在加载中"<<endl;
cout<<"(.";
Sleep(1000);
cout<<".";
Sleep(1000);
cout<<".";
Sleep(1000);
cout<<".";
Sleep(1000);
cout<<".";
Sleep(1000);
cout<<".)"<<endl;
system("cls");
cout<<"加载成功"<<endl;
while(1) {
i--;
cout<<"你想要"<<endl;
cout<<"1.播种 2.仓库 3.商店 4.出售果物 5.订单 6.抽奖 7.快速播种 8.作弊器(不建议使用)9.偷菜"<<endl;
cin>>a;
system("cls");
//等级系统
if(jy>=aa) {
jy-=jy;
dj+=1;
cout<<"恭喜你升级了!"<<endl;
cout<<"你是"<<dj<<"级。"<<endl;
if(dj%2==0)jya*=2;
aa+=jya;
}
//播种
if(a==1) {
cout<<"你要种1.小麦 2.玉米 3.胡萝卜 4.大豆 5.甘蔗 6.南瓜"<<endl;
cout<<"你要做11.面包 12.饲料 13.爆米花 14.喂鸡 15.南瓜面包 16.喂牛"<<endl;
cin>>b;
if(b==1) {
if(za<=0) {
cout<<"你没有小麦种子!"<<endl;
continue;
} else {
cout<<"播种成功!"<<endl;
za-=1;
cout<<"等待3秒种子成熟..." <<endl;
Sleep(3000);
cout<<"成熟了! 你有了两个小麦!"<<endl;
ga+=2;
jy+=2;
Sleep(1000);
cout<<"你加了2经验!"<<endl;
continue;
}
} else if(b==2) {
if(zb<=0) {
cout<<"你没有玉米种子!"<<endl;
continue;
} else {
cout<<"播种成功!"<<endl;
zb-=1;
cout<<"等待5秒种子成熟..." <<endl;
Sleep(5000);
cout<<"成熟了! 你有了两个玉米!"<<endl;
gb+=2;
jy+=4;
Sleep(1000);
cout<<"你加了4经验!"<<endl;
continue;
}
} else if(b==3) {
if(zc<=0) {
cout<<"你没有胡萝卜种子!"<<endl;
continue;
} else {
cout<<"播种成功!"<<endl;
zc-=1;
cout<<"等待7秒种子成熟..." <<endl;
Sleep(7000);
cout<<"成熟了! 你有了两个胡萝卜!"<<endl;
gc+=2;
jy+=6;
Sleep(1000);
cout<<"你加了6经验!"<<endl;
continue;
}
} else if(b==4) {
if(zd<=0) {
cout<<"你没有大豆种子!"<<endl;
continue;
} else {
cout<<"播种成功!"<<endl;
zd-=1;
cout<<"等待10秒种子成熟..." <<endl;
Sleep(10000);
cout<<"成熟了! 你有了两个大豆!"<<endl;
gd+=2;
jy+=6;
Sleep(1000);
cout<<"你加了10经验!"<<endl;
continue;
}
} else if(b==5) {
if(ze<=0) {
cout<<"你没有甘蔗种子!"<<endl;
continue;
} else {
cout<<"播种成功!"<<endl;
ze-=1;
cout<<"等待15秒种子成熟..." <<endl;
Sleep(15000);
cout<<"成熟了!你有了两个甘蔗!"<<endl;
ge+=2;
jy+=15;
Sleep(1000);
cout<<"你加了15经验!"<<endl;
continue;
}
} else if(b==6) {
if(zf<=0) {
cout<<"你没有南瓜种子!"<<endl;
continue;
} else {
cout<<"播种成功!"<<endl;
zf-=1;
cout<<"等待种子成熟..." <<endl;
Sleep(20000);
cout<<"成熟了!你有了两个南瓜!"<<endl;
gf+=2;
jy+=20;
Sleep(1000);
cout<<"你加了20经验!"<<endl;
continue;
}
} else if(b==11) {
if(jm<1) {
cout<<"你没有面包烤炉!"<<endl;
continue;
} else if(ga<3) {
cout<<"你没有足够的小麦!"<<endl;
continue;
} else {
cout<<"做一个面包要3个小麦!"<<endl;
ga-=3;
cout<<"请等待面包烤好。"<<endl;
Sleep(3000);
cout<<"面包烤好了!"<<endl;
cout<<"你加了5点经验!"<<endl;
jy+=5;
mb+=1;
continue;
}
} else if(b==15) {
if(jm<1) {
cout<<"你没有面包烤炉!"<<endl;
continue;
} else if(ga<5) {
cout<<"你没有足够的小麦!"<<endl;
continue;
} else if(egg<2) {
cout<<"你没有足够的鸡蛋!"<<endl;
continue;
} else if(nn<1) {
cout<<"你没有足够的牛奶!"<<endl;
continue;
} else if(gf<5) {
cout<<"你没有足够的南瓜!"<<endl;
continue;
} else {
cout<<"正在制作中。"<<endl;
ga-=5;
nn--;
egg-=2;
gf-=5;
cout<<"请等待面包烤好。"<<endl;
Sleep(8000);
cout<<"面包烤好了!"<<endl;
cout<<"你加了10点经验!"<<endl;
jy+=10;
ngmb+=1;
continue;
}
} else if(b==12) {
if(js==0) {
cout<<"你没有饲料机!"<<endl;
continue;
}
cout<<"你要做 1.鸡饲料 2.牛饲料"<<endl;
cin>>g;
if(g==1) {
cout<<"鸡饲料需要3个小麦 ,2个玉米"<<endl;
if(ga<3) {
cout<<"小麦不够!"<<endl;
continue;
} else if(gb<2) {
cout<<"玉米不够!"<<endl;
continue;
} else {
cout<<"鸡饲料正在制作中!"<<endl;
Sleep(5000);
cout<<"制作完成!"<<endl;
cout<<"获得经验3"<<endl;
jsl+=1;
jy+=3;
ga-=3;
gb-=2;
continue;
}
}
if(g==2) {
cout<<"牛饲料需要3个玉米 ,5个大豆"<<endl;
if(gb<3) {
cout<<"玉米不够!"<<endl;
continue;
} else if(gd<5) {
cout<<"大豆不够!"<<endl;
continue;
} else {
cout<<"牛饲料正在制作中!"<<endl;
Sleep(5000);
cout<<"制作完成!"<<endl;
cout<<"获得经验5"<<endl;
nsl+=1;
jy+=5;
gb-=3;
gd-=5;
continue;
}
}
} else if(b==13) {
if(jb==0) {
cout<<"你没有爆米花机!/n";
continue;
} else if(gb<3) {
cout<<"你没有足够的玉米!/n";
continue;
} else {
cout<<"正在制作中..."<<endl;
Sleep(7000);
cout<<"制作完毕!"<<endl;
cout<<"获得5经验!"<<endl;
jy+=5;
gb-=3;
bmh+=1;
continue;
}
} else if(b==14) {
if(jq==0) {
cout<<"你没有鸡圈!无法喂鸡!"<<endl;
continue;
} else if(jsl==0) {
cout<<"你没有鸡饲料!"<<endl;
continue;
} else {
cout<<"已喂鸡,等待下蛋中..."<<endl;
Sleep(5000);
cout<<"获得1个鸡蛋,5个经验!"<<endl;
egg+=1;
jsl-=1;
jy+=5;
continue;
}
} else if(b==16) {
if(nq==0) {
cout<<"你没有牛圈!无法喂牛!"<<endl;
continue;
} else if(nsl==0) {
cout<<"你没有牛饲料!"<<endl;
continue;
} else {
cout<<"已喂牛,等待牛奶中..."<<endl;
Sleep(8000);
cout<<"获得1个牛奶,7个经验!"<<endl;
nn++;
nsl-=1;
jy+=7;
continue;
}
}
}
//播种结束
//仓库开始
else if(a==2) {
cout<<"你有"<<za<<"小麦种子!"<<endl;
cout<<"你有"<<zb<<"玉米种子!"<<endl;
cout<<"你有"<<zc<<"胡萝卜种子!"<<endl;
cout<<"你有"<<zd<<"大豆种子!"<<endl;
cout<<"你有"<<ze<<"甘蔗种子!"<<endl;
cout<<"你有"<<zf<<"南瓜种子!"<<endl;
cout<<"你有"<<ga<<"小麦!"<<endl;
cout<<"你有"<<gb<<"个玉米!"<<endl;
cout<<"你有"<<gc<<"个胡萝卜!"<<endl;
cout<<"你有"<<gd<<"个大豆!"<<endl;
cout<<"你有"<<ge<<"个甘蔗!"<<endl;
cout<<"你有"<<gf<<"个南瓜!"<<endl;
cout<<"你有"<<mb<<"个面包!"<<endl;
cout<<"你有"<<jsl<<"个鸡饲料。"<<endl;
cout<<"你有"<<egg<<"个鸡蛋。"<<endl;
cout<<"你有"<<bmh<<"个爆米花。"<<endl;
cout<<"你有"<<jinbi<<"金币!"<<endl;
cout<<"你是"<<dj<<"级。"<<endl;
cout<<"你有"<<jj<<"张奖卷。"<<endl;
if(jm==1)cout<<"面包烤炉"<<jm<<"台。"<<endl;
if(js==1)cout<<"饲料机"<<js<<"台。"<<endl;
if(jb==1)cout<<"爆米花机"<<jb<<"台。"<<endl;
if(jq==1)cout<<"鸡圈1个。"<<endl;
if(nq==1)cout<<"牛圈1个。"<<endl;
continue;
}
//仓库结束
//商店开始
else if(a==3) {
cout<<"你想要什么?"<<endl;
cout<<"1.小麦种子 2.玉米种子 3.胡萝卜种子 4.大豆种子 5.甘蔗种子 6.南瓜种子 7.奖卷 8.面包烤炉 9.饲料机 10.鸡圈 11.爆米花机 12.牛圈 13.土地"<<endl;
cin>>c;
if(c==1) {
cout<<"小麦种子1元一个。"<<endl;
cout<<"你要买几个?"<<endl;
cout<<"你有"<<jinbi<<"个金币。"<<endl;
cin>>d;
mj=1;
mj*=d;
if(jinbi<=0) {
cout<<"钱不够!"<<endl;
continue;
} else if(jinbi<mj) {
cout<<"钱不够!"<<endl;
continue;
} else {
cout<<"购买成功!"<<endl;
cout<<"花费"<<mj<<"个金币。"<<endl;
cout<<"快去播种吧!"<<endl;
jinbi-=mj;
za+=d;
continue;
}
}
if(c==2) {
if(dj<3) {
cout<<"等级到3级时解锁!"<<endl;
continue;
} else {
cout<<"玉米种子2元一个。"<<endl;
cout<<"你要买几个?"<<endl;
cout<<"你有"<<jinbi<<"个金币。"<<endl;
cin>>d;
mj=2;
mj*=d;
if(jinbi<=0) {
cout<<"钱不够!"<<endl;
continue;
} else if(jinbi<mj) {
cout<<"钱不够!"<<endl;
continue;
} else {
cout<<"购买成功!"<<endl;
cout<<"花费"<<mj<<"个金币。"<<endl;
cout<<"快去播种吧!"<<endl;
jinbi-=mj;
zb+=d;
continue;
}
}
}
if(c==3) {
if(dj<=4) {
cout<<"等级到5级时解锁!"<<endl;
continue;
} else {
cout<<"胡萝卜种子3元一个。"<<endl;
cout<<"你要买几个?"<<endl;
cout<<"你有"<<jinbi<<"个金币。"<<endl;
cin>>d;
mj=1;
mj*=d;
if(jinbi<=0) {
cout<<"钱不够!"<<endl;
continue;
} else if(jinbi<mj) {
cout<<"钱不够!"<<endl;
continue;
} else {
cout<<"购买成功!"<<endl;
cout<<"花费"<<mj<<"个金币。"<<endl;
cout<<"快去播种吧!"<<endl;
jinbi-=mj;
zc+=d;
continue;
}
}
}
if(c==4) {
if(dj<6) {
cout<<"等级到6级时解锁!"<<endl;
continue;
} else {
cout<<"大豆种子5元一个。"<<endl;
cout<<"你要买几个?"<<endl;
cout<<"你有"<<jinbi<<"个金币。"<<endl;
cin>>d;
mj=5;
mj*=d;
if(jinbi<=0) {
cout<<"钱不够!"<<endl;
continue;
} else if(jinbi<mj) {
cout<<"钱不够!"<<endl;
continue;
} else {
cout<<"购买成功!"<<endl;
cout<<"花费"<<mj<<"个金币。"<<endl;
cout<<"快去播种吧!"<<endl;
jinbi-=mj;
zd+=d;
continue;
}
}
}
if(c==5) {
if(dj<8) {
cout<<"等级到8级时解锁!"<<endl;
continue;
} else {
cout<<"甘蔗种子8元一个。"<<endl;
cout<<"你要买几个?"<<endl;
cout<<"你有"<<jinbi<<"个金币。"<<endl;
cin>>d;
mj=8;
mj*=d;
if(jinbi<=0) {
cout<<"钱不够!"<<endl;
continue;
} else if(jinbi<mj) {
cout<<"钱不够!"<<endl;
continue;
} else {
cout<<"购买成功!"<<endl;
cout<<"花费"<<mj<<"个金币。"<<endl;
cout<<"快去播种吧!"<<endl;
jinbi-=mj;
ze+=d;
continue;
}
}
}
if(c==6) {
if(dj<10) {
cout<<"等级到10级时解锁!"<<endl;
continue;
} else {
cout<<"南瓜种子5元一个。"<<endl;
cout<<"你要买几个?"<<endl;
cout<<"你有"<<jinbi<<"个金币。"<<endl;
cin>>d;
mj=10;
mj*=d;
if(jinbi<=0) {
cout<<"钱不够!"<<endl;
continue;
} else if(jinbi<mj) {
cout<<"钱不够!"<<endl;
continue;
} else {
cout<<"购买成功!"<<endl;
cout<<"花费"<<mj<<"个金币。"<<endl;
cout<<"快去播种吧!"<<endl;
jinbi-=mj;
zf+=d;
continue;
}
}
}
if(c==7) {
cout<<"奖卷20金币一个。"<<endl;
cout<<"你要几个?"<<endl;
cin>>d;
mj=20;
mj*=d;
if(jinbi<mj) {
cout<<"钱不够!"<<endl;
continue;
} else {
cout<<"购买成功!"<<endl;
jj+=d;
jinbi-=mj;
}
}
if(c==8) {
if(dj<5) {
cout<<"等级到5级时解锁!"<<endl;
continue;
} else if(jm>=1) {
cout<<"你已经有了面包烤炉!"<<endl;
continue;
} else {
cout<<"面包烤炉需要100金币。"<<endl;
cout<<"你有"<<jinbi<<"个金币。"<<endl;
if(jinbi<=0) {
cout<<"钱不够!"<<endl;
continue;
} else if(jinbi<100) {
cout<<"钱不够!"<<endl;
continue;
} else {
cout<<"购买成功!"<<endl;
cout<<"花费100个金币。"<<endl;
cout<<"你可以做面包了!"<<endl;
jinbi-=100;
jm++;
continue;
}
}
}
if(c==9) {
if(dj<6) {
cout<<"等级到6级时解锁!"<<endl;
continue;
} else if(js>=1) {
cout<<"你已经有了饲料机!"<<endl;
continue;
} else {
cout<<"饲料机需要75金币。"<<endl;
cout<<"你有"<<jinbi<<"个金币。"<<endl;
if(jinbi<=0) {
cout<<"钱不够!"<<endl;
continue;
} else if(jinbi<75) {
cout<<"钱不够!"<<endl;
continue;
} else {
cout<<"购买成功!"<<endl;
cout<<"花费75个金币。"<<endl;
cout<<"你可以做饲料了!"<<endl;
jinbi-=75;
js++;
continue;
}
}
}
if(c==10) {
if(dj<6) {
cout<<"等级到6级时解锁!"<<endl;
continue;
} else if(jq>=1) {
cout<<"你已经有了鸡圈!"<<endl;
continue;
} else {
cout<<"鸡圈需要75金币。"<<endl;
cout<<"你有"<<jinbi<<"个金币。"<<endl;
if(jinbi<=0) {
cout<<"钱不够!"<<endl;
continue;
} else if(jinbi<100) {
cout<<"钱不够!"<<endl;
continue;
} else {
cout<<"购买成功!"<<endl;
cout<<"花费75个金币。"<<endl;
cout<<"你可以做养鸡了!"<<endl;
jinbi-=75;
jq++;
continue;
}
}
}
if(c==12) {
if(dj<9) {
cout<<"等级到9级时解锁!"<<endl;
continue;
} else if(jq>=1) {
cout<<"你已经有了牛圈!"<<endl;
continue;
} else {
cout<<"牛圈需要250金币。"<<endl;
cout<<"你有"<<jinbi<<"个金币。"<<endl;
if(jinbi<=0) {
cout<<"钱不够!"<<endl;
continue;
} else if(jinbi<250) {
cout<<"钱不够!"<<endl;
continue;
} else {
cout<<"购买成功!"<<endl;
cout<<"花费250个金币。"<<endl;
cout<<"你可以养牛了!"<<endl;
jinbi-=250;
nq++;
continue;
}
}
}
if(c==11) {
if(dj<10) {
cout<<"等级到10级时解锁!"<<endl;
continue;
} else if(jb>=1) {
cout<<"你已经有了爆米花机!"<<endl;
continue;
} else {
cout<<"鸡圈需要300金币。"<<endl;
cout<<"你有"<<jinbi<<"个金币。"<<endl;
if(jinbi<=0) {
cout<<"钱不够!"<<endl;
continue;
} else if(jinbi<300) {
cout<<"钱不够!"<<endl;
continue;
} else {
cout<<"购买成功!"<<endl;
cout<<"花费300个金币。"<<endl;
cout<<"你可以做爆米花了!"<<endl;
jinbi-=300;
jb++;
continue;
}
}
}
if(c==13) {
qq*=1.5;
cout<<"土地"<<qq<<"元一块。"<<endl;
cout<<"1.购买 2.让我想想"<<endl;
cin>>i;
if(i==1) {
if(jinbi<qq) {
cout<<"钱不够!"<<endl;
continue;
} else {
jinbi-=qq;
td+=1;
cout<<"购买成功!"<<endl;
continue;
}
}
}
//商店结束
}
//订单开始
else if(a==5) {
if(ij>10) {
cout<<"需要 1、 5个鸡蛋 2、10个面包 3、3个爆米花 4、10个南瓜"<<endl;
cout<<"完成订单奖励:125金币 110经验" <<endl;
cout<<"1.完成订单 2.让我想想"<<endl;
cin>>da;
if(da==1) {
if(egg<5) {
cout<<"鸡蛋不够!"<<endl;
continue;
} else if(mb<10) {
cout<<"面包不够!"<<endl;
continue;
} else if(bmh<3) {
cout<<"爆米花不够!"<<endl;
continue;
} else if(gf<10) {
cout<<"南瓜不够!"<<endl;
continue;
} else {
cout<<"已完成订单。"<<endl;
egg-=5;
mb-=10;
bmh-=3;
gf-=10;
jinbi+=125;
jy+=150;
ij++;
continue;
}
} else continue;
} else if(ij>9) {
cout<<"需要 1、5个鸡蛋 2、3个爆米花 3、10个甘蔗"<<endl;
cout<<"完成订单奖励:100金币 70经验" <<endl;
cout<<"1.完成订单 2.让我想想"<<endl;
cin>>da;
if(da==1) {
if(egg<5) {
cout<<"鸡蛋不够!"<<endl;
continue;
} else if(bmh<3) {
cout<<"爆米花不够!"<<endl;
continue;
} else if(ge<10) {
cout<<"甘蔗不够!"<<endl;
continue;
} else {
cout<<"已完成订单。"<<endl;
egg-=5;
bmh-=3;
ge-=10;
jinbi+=100;
jy+=130;
ij++;
continue;
}
} else continue;
} else if(ij>8) {
cout<<"需要 1、3个鸡蛋 2、10个胡萝卜 3、5个南瓜"<<endl;
cout<<"完成订单奖励:80金币 60经验" <<endl;
cout<<"1.完成订单 2.让我想想"<<endl;
cin>>da;
if(da==1) {
if(egg<3) {
cout<<"鸡蛋不够!"<<endl;
continue;
} else if(gd<10) {
cout<<"胡萝卜不够!"<<endl;
continue;
} else if(gf<5) {
cout<<"南瓜不够!"<<endl;
continue;
} else {
cout<<"已完成订单。"<<endl;
egg-=3;
gd-=10;
gf-=5;
jinbi+=80;
jy+=60;
ij++;
continue;
}
} else continue;
} else if(ij>7) {
cout<<"需要 1、10个甘蔗 2、20个胡萝卜 3、5个南瓜"<<endl;
cout<<"完成订单奖励:70金币 55经验" <<endl;
cout<<"1.完成订单 2.让我想想"<<endl;
cin>>da;
if(da==1) {
if(ge<10) {
cout<<"甘蔗不够!"<<endl;
continue;
} else if(gd<20) {
cout<<"胡萝卜不够!"<<endl;
continue;
} else if(gf<5) {
cout<<"南瓜不够!"<<endl;
continue;
} else {
cout<<"已完成订单。"<<endl;
ge-=10;
gd-=20;
gf-=5;
jinbi+=70;
jy+=55;
ij++;
continue;
}
} else continue;
} else if(ij>6) {
cout<<"需要 1、15个胡萝卜 2、10个大豆 3、5个甘蔗"<<endl;
cout<<"完成订单奖励:50金币 40经验" <<endl;
cout<<"1.完成订单 2.让我想想"<<endl;
cin>>da;
if(da==1) {
if(gc<15) {
cout<<"胡萝卜不够!"<<endl;
continue;
} else if(gd<10) {
cout<<"大豆不够!"<<endl;
continue;
} else if(ge<5) {
cout<<"甘蔗不够!"<<endl;
continue;
} else {
cout<<"已完成订单。"<<endl;
gc-=15;
gd-=10;
ge-=5;
jinbi+=50;
jy+=40;
ij++;
continue;
}
} else continue;
} else if(ij>5) {
cout<<"需要 1、面包5个 2、玉米10个 3、5个胡萝卜"<<endl;
cout<<"完成订单奖励:40金币 35经验" <<endl;
cout<<"1.完成订单 2.让我想想"<<endl;
cin>>da;
if(da==1) {
if(mb<5) {
cout<<"面包不够!"<<endl;
continue;
} else if(gb<10) {
cout<<"玉米不够!"<<endl;
continue;
} else if(gc<5) {
cout<<"胡萝卜不够!"<<endl;
continue;
} else {
cout<<"已完成订单。"<<endl;
mb-=5;
gb-=10;
gc-=5;
jinbi+=40;
jy+=35;
ij++;
continue;
}
} else continue;
} else if(ij>4) {
cout<<"需要 1、面包3个 2、玉米5个 3、3个胡萝卜"<<endl;
cout<<"完成订单奖励:30金币 30经验" <<endl;
cout<<"1.完成订单 2.让我想想"<<endl;
cin>>da;
if(da==1) {
if(mb<3) {
cout<<"面包不够!"<<endl;
continue;
} else if(gb<5) {
cout<<"玉米不够!"<<endl;
continue;
} else if(gc<3) {
cout<<"胡萝卜不够!"<<endl;
continue;
} else {
cout<<"已完成订单。"<<endl;
mb-=3;
gb-=5;
gc-=3;
jinbi+=30;
jy+=30;
ij++;
continue;
}
} else continue;
} else if(ij>3) {
cout<<"需要 1、10个玉米 2、5个胡萝卜"<<endl;
cout<<"完成订单奖励:25金币 25经验" <<endl;
cout<<"1.完成订单 2.让我想想"<<endl;
cin>>da;
if(da==1) {
if(gb<10) {
cout<<"玉米不够!"<<endl;
continue;
} else if(gc<5) {
cout<<"胡萝卜不够!"<<endl;
continue;
} else {
cout<<"已完成订单。"<<endl;
gb-=10;
gc-=5;
jinbi+=25;
jy+=25;
ij++;
continue;
}
} else continue;
} else if(ij>2) {
cout<<"需要 1、15个小麦 2、5个玉米"<<endl;
cout<<"完成订单奖励:20金币 15经验" <<endl;
cout<<"1.完成订单 2.让我想想"<<endl;
cin>>da;
if(da==1) {
if(ga<15) {
cout<<"小麦不够!"<<endl;
continue;
} else if(gb<5) {
cout<<"玉米不够!"<<endl;
continue;
} else {
cout<<"已完成订单。"<<endl;
ga-=15;
gb-=5;
jinbi+=20;
jy+=15;
ij++;
continue;
}
} else continue;
} else if(ij>1) {
cout<<"需要 1、10 个小麦"<<endl;
cout<<"完成订单奖励:15金币 15经验" <<endl;
cout<<"1.完成订单 2.让我想想"<<endl;
cin>>da;
if(da==1) {
if(ga<10) {
cout<<"小麦不够!"<<endl;
continue;
} else {
cout<<"已完成订单。"<<endl;
ga-=10;
jinbi+=15;
jy+=15;
ij++;
continue;
}
} else continue;
} else if(ij>0) {
cout<<"需要 1、5 个小麦"<<endl;
cout<<"完成订单奖励:10金币 10经验" <<endl;
cout<<"1.完成订单 2.让我想想"<<endl;
cin>>da;
if(da==1) {
if(ga<5) {
cout<<"小麦不够!"<<endl;
continue;
} else {
cout<<"已完成订单。"<<endl;
ga-=5;
jinbi+=10;
jy+=10;
ij++;
continue;
}
} else continue;
}
}
//出售果物开始
else if(a==4) {
cout<<"你要卖什么?"<<endl;
cout<<"1.小麦 2.玉米 3.胡萝卜 4.大豆 5.甘蔗 6.南瓜 7.面包 8.鸡蛋 9.爆米花 10.牛奶 11.南瓜面包"<<endl;
cin>>e;
if(e==1) {
if(ga<=0) {
cout<<"没有小麦!"<<endl;
continue;
} else {
cout<<"你要卖几个?"<<endl;
cout<<"小麦1金币1个。"<<endl;
cout<<"你有"<<ga<<"个小麦。"<<endl;
cin>>f;
if(f>ga) {
cout<<"你没有那么多!"<<endl;
continue;
} else {
ga-=f;
cout<<"出售成功!"<<endl;
cout<<"获得了"<<f<<"个金币!"<<endl;
jinbi+=f;
continue;
}
}
}
if(e==2) {
if(gb<=0) {
cout<<"没有玉米!"<<endl;
continue;
} else {
cout<<"你要卖几个?"<<endl;
cout<<"玉米2金币1个。"<<endl;
cout<<"你有"<<gb<<"个玉米。"<<endl;
cin>>f;
if(f>gb) {
cout<<"你没有那么多!"<<endl;
continue;
} else {
gb-=f;
f*=2;
cout<<"出售成功!"<<endl;
cout<<"获得了"<<f<<"个金币!"<<endl;
jinbi+=f;
continue;
}
}
}
if(e==3) {
if(gc<=0) {
cout<<"没有胡萝卜!"<<endl;
continue;
} else {
cout<<"你要卖几个?"<<endl;
cout<<"胡萝卜4金币1个。"<<endl;
cout<<"你有"<<gc<<"个胡萝卜。"<<endl;
cin>>f;
if(f>gc) {
cout<<"你没有那么多!"<<endl;
continue;
} else {
gc-=f;
f*=4;
cout<<"出售成功!"<<endl;
cout<<"获得了"<<f<<"个金币!"<<endl;
jinbi+=f;
continue;
}
}
}
if(e==4) {
if(gd<=0) {
cout<<"没有大豆!"<<endl;
continue;
} else {
cout<<"你要卖几个?"<<endl;
cout<<"大豆8金币1个。"<<endl;
cout<<"你有"<<gd<<"个大豆。"<<endl;
cin>>f;
if(f>gd) {
cout<<"你没有那么多!"<<endl;
continue;
} else {
gd-=f;
f*=8;
cout<<"出售成功!"<<endl;
cout<<"获得了"<<f<<"个金币!"<<endl;
jinbi+=f;
continue;
}
}
}
if(e==5) {
if(ge<=0) {
cout<<"没有甘蔗!"<<endl;
continue;
} else {
cout<<"你要卖几个?"<<endl;
cout<<"甘蔗10金币1个。"<<endl;
cout<<"你有"<<ge<<"个甘蔗。"<<endl;
cin>>f;
if(f>ge) {
cout<<"你没有那么多!"<<endl;
continue;
} else {
ge-=f;
f*=10;
cout<<"出售成功!"<<endl;
cout<<"获得了"<<f<<"个金币!"<<endl;
jinbi+=f;
continue;
}
}
}
if(e==6) {
if(gf<=0) {
cout<<"没有南瓜!"<<endl;
continue;
} else {
cout<<"你要卖几个?"<<endl;
cout<<"南瓜12金币1个。"<<endl;
cout<<"你有"<<gf<<"个南瓜。"<<endl;
cin>>f;
if(f>gf) {
cout<<"你没有那么多!"<<endl;
continue;
} else {
gf-=f;
f*=12;
cout<<"出售成功!"<<endl;
cout<<"获得了"<<f<<"个金币!"<<endl;
jinbi+=f;
continue;
}
}
}
if(e==7) {
if(mb<=0) {
cout<<"没有面包!"<<endl;
continue;
} else {
cout<<"你要卖几个?"<<endl;
cout<<"面包8金币1个。"<<endl;
cout<<"你有"<<mb<<"个面包。"<<endl;
cin>>f;
if(f>mb) {
cout<<"你没有那么多!"<<endl;
continue;
} else {
mb-=f;
f*=8;
cout<<"出售成功!"<<endl;
cout<<"获得了"<<f<<"个金币!"<<endl;
jinbi+=f;
continue;
}
}
}
if(e==8) {
if(egg<=0) {
cout<<"没有鸡蛋!"<<endl;
continue;
} else {
cout<<"你要卖几个?"<<endl;
cout<<"鸡蛋10金币1个。"<<endl;
cout<<"你有"<<egg<<"个鸡蛋。"<<endl;
cin>>f;
if(f>egg) {
cout<<"你没有那么多!"<<endl;
continue;
} else {
egg-=f;
f*=10;
cout<<"出售成功!"<<endl;
cout<<"获得了"<<f<<"个金币!"<<endl;
jinbi+=f;
continue;
}
}
}
if(e==9) {
if(bmh<=0) {
cout<<"没有爆米花!"<<endl;
continue;
} else {
cout<<"你要卖几个?"<<endl;
cout<<"爆米花15金币1个。"<<endl;
cout<<"你有"<<bmh<<"个爆米花。"<<endl;
cin>>f;
if(f>bmh) {
cout<<"你没有那么多!"<<endl;
continue;
} else {
bmh-=f;
f*=15;
cout<<"出售成功!"<<endl;
cout<<"获得了"<<f<<"个金币!"<<endl;
jinbi+=f;
continue;
}
}
}
if(e==10) {
if(nn<=0) {
cout<<"没有牛奶!"<<endl;
continue;
} else {
cout<<"你要卖几个?"<<endl;
cout<<"牛奶17金币1个。"<<endl;
cout<<"你有"<<nn<<"个牛奶。"<<endl;
cin>>f;
if(f>nn) {
cout<<"你没有那么多!"<<endl;
continue;
} else {
nn-=f;
f*=17;
cout<<"出售成功!"<<endl;
cout<<"获得了"<<f<<"个金币!"<<endl;
jinbi+=f;
continue;
}
}
}
if(e==11) {
if(ngmb<=0) {
cout<<"没有南瓜面包!"<<endl;
continue;
} else {
cout<<"你要卖几个?"<<endl;
cout<<"南瓜面包50金币1个。"<<endl;
cout<<"你有"<<ngmb<<"个南瓜面包。"<<endl;
cin>>f;
if(f>ngmb) {
cout<<"你没有那么多!"<<endl;
continue;
} else {
bmh-=f;
f*=50;
cout<<"出售成功!"<<endl;
cout<<"获得了"<<f<<"个金币!"<<endl;
jinbi+=f;
continue;
}
}
}
}
//出售果物结束
//抽奖开始
else if(a==6) {
if(jj<=0) {
cout<<"没有奖卷!"<<endl;
continue;
} else {
cout<<"开始抽奖!"<<endl;
Sleep(2000);
srand(time(0));
zj=rand()%6+1;
jj--;
if(zj==1) {
cout<<"你得到了3个鸡蛋!"<<endl;
egg+=3;
continue;
}
if(zj==2) {
cout<<"你得到了1个爆米花!"<<endl;
bmh+=1;
continue;
}
if(zj==3) {
cout<<"你得到了2个南瓜种子!"<<endl;
zf+=2;
continue;
}
if(zj==4) {
cout<<"你得到了5个面包!"<<endl;
mb+=1;
continue;
}
if(zj==5) {
cout<<"你得到了10个胡萝卜!"<<endl;
gc+=10;
continue;
}
if(zj==6) {
cout<<"你得到了1个南瓜面包!"<<endl;
ngmb+=1;
continue;
}
}
} else if(a==7) {
cout<<"你要种 1.小麦 2.玉米 3.胡萝卜 4.大豆 5.甘蔗 6.南瓜"<<endl;
cout<<"你有"<<td<<"块土地。"<<endl;
cin>>qqq;
if(qqq==1) {
cout<<"你要种几个?"<<endl;
cin>>d;
if(d>za) {
cout<<"不够!"<<endl;
continue;
} else if(d>td) {
cout<<"土地不够!"<<endl;
continue;
} else {
cout<<"播种成功!"<<endl;
Sleep(3000);
za-=d;
ga+=d*2;
jy+=3*d;
continue;
}
}
if(qqq==2) {
cout<<"你要种几个?"<<endl;
cin>>d;
if(d>zb) {
cout<<"不够!"<<endl;
continue;
} else if(d>td) {
cout<<"土地不够!"<<endl;
continue;
} else {
cout<<"播种成功!"<<endl;
Sleep(5000);
zb-=d;
gb+=d*2;
jy+=5*d;
continue;
}
}
if(qqq==3) {
cout<<"你要种几个?"<<endl;
cin>>d;
if(d>zc) {
cout<<"不够!"<<endl;
continue;
} else if(d>td) {
cout<<"土地不够!"<<endl;
continue;
} else {
cout<<"播种成功!"<<endl;
Sleep(7000);
zc-=d;
gc+=d*2;
jy+=7*d;
continue;
}
}
if(qqq==4) {
cout<<"你要种几个?"<<endl;
cin>>d;
if(d>zd) {
cout<<"不够!"<<endl;
continue;
} else if(d>td) {
cout<<"土地不够!"<<endl;
continue;
} else {
cout<<"播种成功!"<<endl;
Sleep(9000);
zd-=d;
gd+=d*2;
jy+=10*d;
continue;
}
}
if(qqq==5) {
cout<<"你要种几个?"<<endl;
cin>>d;
if(d>ze) {
cout<<"不够!"<<endl;
continue;
} else if(d>td) {
cout<<"土地不够!"<<endl;
continue;
} else {
cout<<"播种成功!"<<endl;
Sleep(11000);
ze-=d;
ge+=d*2;
jy+=12*d;
continue;
}
}
if(qqq==6) {
cout<<"你要种几个?"<<endl;
cin>>d;
if(d>zf) {
cout<<"不够!"<<endl;
continue;
} else if(d>td) {
cout<<"土地不够!"<<endl;
continue;
} else {
cout<<"播种成功!"<<endl;
Sleep(13000);
zf-=d;
gf+=d*2;
jy+=15*d;
continue;
}
}
}
//作弊器开始
else if(a==8) {
cout<<"请输入密码:"<<endl;
cin>>ma;
if(ma==951656666) {
cout<<"你要改什么?"<<endl;
cout<<"1.金币 2.小麦种子数 3.玉米种子数 4.胡萝卜种子数 5.大豆种子数 6.甘蔗种子数 7.南瓜种子数 8.小麦数 9.玉米数 10.胡萝卜数 11.大豆数 12.甘蔗数 13.南瓜数 14.等级 15.退出"<<endl;
cin>>bb;
if(bb==1) {
cout<<"你要改成多少?"<<endl;
cin>>cc;
jinbi+=cc;
cout<<"修改成功!"<<endl;
continue;
} else if(bb==2) {
cout<<"你要改成多少?"<<endl;
cin>>cc;
za+=cc;
cout<<"修改成功!"<<endl;
continue;
} else if(bb==3) {
cout<<"你要改成多少?"<<endl;
cin>>cc;
zb+=cc;
cout<<"修改成功!"<<endl;
continue;
} else if(bb==4) {
cout<<"你要改成多少?"<<endl;
cin>>cc;
zc+=cc;
cout<<"修改成功!"<<endl;
continue;
} else if(bb==5) {
cout<<"你要改成多少?"<<endl;
cin>>cc;
zd+=cc;
cout<<"修改成功!"<<endl;
continue;
} else if(bb==6) {
cout<<"你要改成多少?"<<endl;
cin>>cc;
ze+=cc;
cout<<"修改成功!"<<endl;
continue;
} else if(bb==7) {
cout<<"你要改成多少?"<<endl;
cin>>cc;
zf+=cc;
cout<<"修改成功!"<<endl;
continue;
} else if(bb==8) {
cout<<"你要改成多少?"<<endl;
cin>>cc;
ga+=cc;
cout<<"修改成功!"<<endl;
continue;
} else if(bb==9) {
cout<<"你要改成多少?"<<endl;
cin>>cc;
gb+=cc;
cout<<"修改成功!"<<endl;
continue;
} else if(bb==10) {
cout<<"你要改成多少?"<<endl;
cin>>cc;
gc+=cc;
cout<<"修改成功!"<<endl;
continue;
} else if(bb==11) {
cout<<"你要改成多少?"<<endl;
cin>>cc;
gd+=cc;
cout<<"修改成功!"<<endl;
continue;
} else if(bb==12) {
cout<<"你要改成多少?"<<endl;
cin>>cc;
ge+=cc;
cout<<"修改成功!"<<endl;
continue;
} else if(bb==13) {
cout<<"你要改成多少?"<<endl;
cin>>cc;
gf+=cc;
cout<<"修改成功!"<<endl;
continue;
} else if(bb==14) {
cout<<"你要改成多少?"<<endl;
cin>>cc;
dj+=cc;
cout<<"修改成功!"<<endl;
continue;
} else if(bb==15)continue;
} else {
cout<<"密码错误!"<<endl;
continue;
}
}
//作弊器结束
if(a==9) {
cout<<"正在偷菜中..."<<endl;
Sleep(10000);
srand(time(0));
qj=rand()%6+1;
if(qj==2) {
cout<<"运气真好!获得小麦5个!"<<endl;
ga+=5;
continue;
}
if(qj==3) {
cout<<"运气真好!获得玉米4个!"<<endl;
gb+=5;
continue;
}
if(qj==4) {
cout<<"运气真好!获得胡萝卜3个!"<<endl;
gc+=5;
continue;
}
if(qj==5) {
cout<<"运气真好!获得大豆2个!"<<endl;
gd+=5;
continue;
}
if(qj==6) {
cout<<"运气真好!获得甘蔗1个!"<<endl;
ge+=1;
continue;
} else {
cout<<"运气不好,被罚了50金币!"<<endl;
jinbi-=50;
continue;
}
}
}
}
int main_f8() {
system("color f0");//先用黑底白字,顺眼
printf("\
神奇宝贝\n\
n\
著作者:朱逸轩\n\n");
Sleep (1000);
printf("很久以前,有一对兄弟--小火和小水。他们一直以神奇宝贝大师为目标,不断进行战斗。\n\n");
Sleep (1000);
printf("但水火不容,他们慢慢积下了对互相的仇恨。\n\n");
Sleep (1000);
printf("不久,一场大战便引发了。\n\n");
Sleep (1000);
printf("大战了三天三夜,三百万个回合。终于,小水的盖欧卡被小火用固拉多封印在火山底。\n\n");
Sleep (1000);
printf("一天,固拉多用最后一点神力,从梦中告诉你:\n\
“和平只是短暂的,终有一日盖欧卡会苏醒过来。”\n\n\
说罢,便将神奇宝贝球交给了你。\n\n");
Sleep(1000);
printf("一场新的故事拉开了序幕...\n\n");
Sleep(1000);
char mz[11];//十个字符
char jiaochen ,mxp,mx,ms,shop,pl,gl1,gl2,gl3,gl4,gd;
int sj,xue1,xue2,xue3,xue4,xue5,xue6,xue7,xue8,xue9,xue10,gj=15,xue=200,s2,db,bd1,dbm,gl,dj=0;
float s1,money=100;
printf(" 你的名字:");
cin>>mz;
printf("是否需要教程?(Y or N)\n");
cin>>jiaochen;
if( (jiaochen != 'Y'&&jiaochen!='y') && (jiaochen != 'N'&&jiaochen!='n') ) { //输入错误
cout<<"乱输!"<<endl;
}
if((jiaochen=='Y')||(jiaochen=='y')) { //教程
printf("亲爱的%s:\n若输1,则进入冒险模式。\n若输2,则进入商店模式。\n若输3,则进入状态显示模式。\n刚进入时有100元,好好利用他吧!\n没钱就进入冒险模式打怪赚钱吧!更多玩法等待你发现...\n", mz);
}//教程完
while(1) { //主程序
loop:
printf("\n\n1--冒险模式 2--商店模式 3--状态显示模式 4--赌博模式 5--管理模式");
cin>>ms;
if(ms=='1') { //冒险模式
printf(" E--退出\n 1--皮神的试炼\n 2--获得传说神兽皮卡丘\n 3--招唤固拉多\n 4--获得胡帕\n 5--胡帕(被解放)\n 6--mage暴走皮神\n 7--获得全部传说神兽\n 8--盖欧卡解开封印\n 9--神兽合体mage阿尔宙斯x,y&z\n A--决战超进化mage盖欧卡x,y&z\n");
cin>>mx;
if(mx=='E'||mx=='e') {
goto loop;
}
if(mx == '1') {
//1
xue1=50;
while(xue1>0) {
printf("皮神冲了过来,是否逃跑?(Y or N)");
cin>>mxp;
srand((unsigned)time(NULL));
sj = rand();
if(mxp == 'Y'||mxp=='y') {
if(sj%2==0) {
cout<<"逃跑成功!"<<endl;
break;
} else {
xue-=10;
printf("逃跑失败!你被扣了10滴血,剩%d滴血。\n", xue);
}
}
if(mxp == 'N'||mxp=='n') {
xue1-=gj;
xue-=10;
printf("你的神奇宝贝被扣了10滴血,剩%d滴血。\n敌人被扣了%d滴血,剩%d滴血。\n",xue,gj,xue1);
}
if(xue <= 0) {
printf("你的神奇宝贝失去了战斗能力!");
Sleep(10000000);
return 0;
}
}
if(xue1 <= 0) {
money+=30;
dj+=25;
printf("你赢了!加30元,25经验,现有%.2f元,%d经验", money,dj);
}
}//1完
if(mx == '2') {
//2
xue2=100;
while(xue2>0) {
printf("皮卡丘冲了过来,是否逃跑?(Y or N)");
cin>>mxp;
srand((unsigned)time(NULL));
sj = rand();
if(mxp == 'Y'||mxp=='y') {
if(sj%2==0) {
cout<<"逃跑成功!"<<endl;
break;
} else {
xue-=20;
printf("逃跑失败!你被扣了20滴血,剩%d滴血。\n", xue);
}
}
if(mxp == 'N'||mxp=='n') {
xue2-=gj;
xue-=20;
printf("你的神奇宝贝被扣了20滴血,剩%d滴血。\n敌人被扣了%d滴血,剩%d滴血。\n",xue,gj,xue2);
}
if(xue <= 0) {
printf("你的神奇宝贝失去了战斗能力!");
Sleep(10000000);
return 0;
}
}
if(xue2 <= 0) {
money+=60;
dj+=50;
printf("你赢了!加60元,50经验,现有%.2f元,%d经验", money,dj);
}
}//2完
if(mx == '3') {
//3
xue3=200;
while(xue3>0) {
printf("固拉多冲了过来,是否逃跑?(Y or N)");
cin>>mxp;
srand((unsigned)time(NULL));
sj = rand();
if(mxp == 'Y'||mxp=='y') {
if(sj%2==0) {
cout<<"逃跑成功!"<<endl;
break;
} else {
xue-=40;
printf("逃跑失败!你被扣了40滴血,剩%d滴血。\n", xue);
}
}
if(mxp == 'N'||mxp=='n') {
xue3-=gj;
xue-=40;
printf("你的神奇宝贝被扣了40滴血,剩%d滴血。\n敌人被扣了%d滴血,剩%d滴血。\n",xue,gj,xue3);
}
if(xue <= 0) {
printf("你的神奇宝贝失去了战斗能力!");
Sleep(10000000);
return 0;
}
}
if(xue3 <= 0) {
money+=120;
dj+=100;
printf("你赢了!加120元,100经验现有%.2f元,%d经验", money,dj);
}
}//3完
if(mx == '4') {
//4
xue4=400;
while(xue4>0) {
printf("胡帕冲了过来,是否逃跑?(Y or N)");
cin>>mxp;
srand((unsigned)time(NULL));
sj = rand();
if(mxp == 'Y'||mxp=='y') {
if(sj%2==0) {
cout<<"逃跑成功!"<<endl;
break;
} else {
xue-=80;
printf("逃跑失败!你被扣了80滴血,剩%d滴血。\n", xue);
}
}
if(mxp == 'N'||mxp=='n') {
xue4-=gj;
xue-=80;
printf("你的神奇宝贝被扣了40滴血,剩%d滴血。\n敌人被扣了%d滴血,剩%d滴血。\n",xue,gj,xue4);
}
if(xue <= 0) {
printf("你的神奇宝贝失去了战斗能力!");
Sleep(10000000);
return 0;
}
}
if(xue4 <= 0) {
money+=240;
dj+=200;
printf("你赢了!加240元,200经验,现有%.2f元,%d经验", money,dj);
}
}//4完
if(mx == '5') {
//5
xue5=800;
while(xue5>0) {
printf("胡帕(被解放)冲了过来,是否逃跑?(Y or N)");
cin>>mxp;
srand((unsigned)time(NULL));
sj = rand();
if(mxp == 'Y'||mxp=='y') {
if(sj%2==0) {
cout<<"逃跑成功!"<<endl;
break;
} else {
xue-=160;
printf("逃跑失败!你被扣了160滴血,剩%d滴血。\n", xue);
}
}
if(mxp == 'N'||mxp=='n') {
xue5-=gj;
xue-=160;
printf("你的神奇宝贝被扣了160滴血,剩%d滴血。\n敌人被扣了%d滴血,剩%d滴血。\n",xue,gj,xue5);
}
if(xue <= 0) {
printf("你的神奇宝贝失去了战斗能力!");
Sleep(10000000);
return 0;
}
}
if(xue5 <= 0) {
money+=480;
dj+=400;
printf("你赢了!加480元,400经验,现有%.2f元,%d经验", money,dj);
}
}//5完
if(mx == '6') {
//6
xue6=800;
while(xue6>0) {
printf("mage暴走皮神冲了过来,是否逃跑?(Y or N)");
cin>>mxp;
srand((unsigned)time(NULL));
sj = rand();
if(mxp == 'Y'||mxp=='y') {
if(sj%2==0) {
cout<<"逃跑成功!"<<endl;
break;
} else {
xue-=320;
printf("逃跑失败!你被扣了320滴血,剩%d滴血。\n", xue);
}
}
if(mxp == 'N'||mxp=='n') {
xue6-=gj;
xue-=320;
printf("你的神奇宝贝被扣了3200滴血,剩%d滴血。\n敌人被扣了%d滴血,剩%d滴血。\n",xue,gj,xue6);
}
if(xue <= 0) {
printf("你的神奇宝贝失去了战斗能力!");
Sleep(10000000);
return 0;
}
}
if(xue6 <= 0) {
money+=960;
dj+=800;
printf("你赢了!加960元,800经验,现有%.2f元,%d经验", money,dj);
}
}//6完
if(mx == '7') {
//7
xue7=1600;
while(xue7>0) {
printf("全部神兽冲了过来,是否逃跑?(Y or N)");
cin>>mxp;
srand((unsigned)time(NULL));
sj = rand();
if(mxp == 'Y'||mxp=='y') {
if(sj%2==0) {
cout<<"逃跑成功!"<<endl;
break;
} else {
xue-=640;
printf("逃跑失败!你被扣了640滴血,剩%d滴血。\n", xue);
}
}
if(mxp == 'N'||mxp=='n') {
xue7-=gj;
xue-=640;
printf("你的神奇宝贝被扣了6400滴血,剩%d滴血。\n敌人被扣了%d滴血,剩%d滴血。\n",xue,gj,xue7);
}
if(xue <= 0) {
printf("你的神奇宝贝失去了战斗能力!");
Sleep(10000000);
return 0;
}
}
if(xue7 <= 0) {
money+=1980;
dj+=1600;
printf("你赢了!加1980元,1600经验,现有%.2f元,%d经验", money,dj);
}
}//7完
if(mx == '8') {
//8
xue8=3200;
while(xue8>0) {
printf("mage阿尔宙斯x,y&z`冲了过来,是否逃跑?(Y or N)");
cin>>mxp;
srand((unsigned)time(NULL));
sj = rand();
if(mxp == 'Y'||mxp=='y') {
if(sj%2==0) {
cout<<"逃跑成功!"<<endl;
break;
} else {
xue-=1280;
printf("逃跑失败!你被扣了1280滴血,剩%d滴血。\n", xue);
}
}
if(mxp == 'N'||mxp=='n') {
xue8-=gj;
xue-=1280;
printf("你的神奇宝贝被扣了12800滴血,剩%d滴血。\n敌人被扣了%d滴血,剩%d滴血。\n",xue,gj,xue8);
}
if(xue <= 0) {
printf("你的神奇宝贝失去了战斗能力!");
Sleep(10000000);
return 0;
}
}
if(xue8 <= 0) {
money+=3960;
dj+=3200;
printf("你赢了!加3960元,3200经验,现有%.2f元,%d经验", money,dj);
}
}//8完
if(mx == '9') {
//9
xue9=6400;
while(xue9>0) {
printf("盖欧卡冲了过来,是否逃跑?(Y or N)");
cin>>mxp;
srand((unsigned)time(NULL));
sj = rand();
if(mxp == 'Y'||mxp=='y') {
if(sj%2==0) {
cout<<"逃跑成功!"<<endl;
break;
} else {
xue-=2560;
printf("逃跑失败!你被扣了2560滴血,剩%d滴血。\n", xue);
}
}
if(mxp == 'N'||mxp=='n') {
xue9-=gj;
xue-=25600;
printf("你的神奇宝贝被扣了25600滴血,剩%d滴血。\n敌人被扣了%d滴血,剩%d滴血。\n",xue,gj,xue9);
}
if(xue <= 0) {
printf("你的神奇宝贝失去了战斗能力!");
Sleep(10000000);
return 0;
}
}
if(xue9 <= 0) {
money+=7980;
dj+=6400;
printf("你赢了!加7980元,6400经验,现有%.2f元%d经验", money,dj);
}
}//9完
if(mx == 'a'||mx=='A' ) {
//10
xue10=12800;
while(xue10>0) {
printf("超进化mage盖欧卡x,y&z冲了过来,是否逃跑?(Y or N)");
cin>>mxp;
srand((unsigned)time(NULL));
sj = rand();
if(mxp == 'Y'||mxp=='y') {
if(sj%2==0) {
cout<<"逃跑成功!"<<endl;
break;
} else {
xue-=5120;
printf("逃跑失败!你被扣了5120滴血,剩%d滴血。\n", xue);
}
}
if(mxp == 'N'||mxp=='n') {
xue10-=gj;
xue-=51200;
printf("你的神奇宝贝被扣了51200滴血,剩%d滴血。\n敌人被扣了%d滴血,剩%d滴血。\n",xue,gj,xue10);
}
if(xue <= 0) {
printf("你的神奇宝贝失去了战斗能力!");
Sleep(10000000);
return 0;
}
}
if(xue10 <= 0) {
money+=15960;
dj+=12800;
printf("你赢了!加1556元,12800经验,现有%.2f元,%d经验", money,dj);
}
}//10完
}//冒险模式完
if(ms=='2') { //商店模式
printf("\n E--退出\n 1--力量药水I(加20攻击力)--40元\n 2--力量药水II(加40攻击力)--80元\n 3--力量药水III(加80攻击力)--160元\n 4--治疗药水I(加160滴血)--40元\n 5--治疗药水II(加320滴血)--80元\n 6--治疗药水III(加640滴血)--160元\n 7--批量购买\n若金钱不足自动跳出");
cin>>shop;
if( (shop == '1') && (money >= 40) ) {
gj += 20; //1
money-=40;
printf("\n\n成功!你有%d点攻击,%.2f元\n" ,gj,money);
}
if( (shop == '2') && (money >= 80) ) {
gj += 40; //2
money-=80;
printf("\n\n成功!你有%d点攻击,%.2f元\n" ,gj,money);
}
if( (shop == '3') && (money >= 160) ) {
gj += 80; //3
money-=160;
printf("\n\n成功!你有%d点攻击,%.2f元\n" ,gj,money);
}
if( (shop == '4') && (money >= 40) ) {
xue += 160; //4
money-=40;
printf("\n\n成功!你有%d滴血,%.2f元\n" ,xue,money);
}
if( (shop == '5') && (money >= 80) ) {
xue += 320; //5
money-=80;
printf("\n\n成功!你有%d滴血,%.2f元\n" ,xue,money);
}
if( (shop == '6') && (money >= 160) ) {
xue += 640; //6
money-=160;
printf("\n\n成功!你有%d滴血,%.2f元\n" ,xue,money);
}
if(shop=='e'||shop=='E')goto loop;
if( shop == '7') {
//7
printf("\n E--退出\n 1--力量型药水\n 2--治疗型药水");
cin>>pl;
if(pl=='e'||pl=='E')goto loop;
if(pl == '1') {
printf("请输入要加的攻击:");
cin>>s2;
s1 = s2/20.00*40;
if(money >= s1) {
gj+=s2;
money-=s1;
printf("\n\n成功!你有%d点攻击,%.2f元\n" ,gj,money);
}
}
if(pl == '2') {
printf("请输入要加的血:");
cin>>s2;
s1 = s2/160.00*40;
if(money >= s1) {
xue+=s2;
money-=s1;
printf("\n\n成功!你有%d滴血,%.2f元\n" ,xue,money);
}
}
}//7完
}//商店模式完
if(ms=='3') { //状态显示模式
printf("\n你有%d滴血,%d点攻击,%.2f元。\n" ,xue,gj,money);
}//状态显示模式
if( (ms!='1') && (ms!='2') && (ms!='3') &&(ms!='4')&&(ms!='5')) {
cout<<"\n乱输的孩子不是好孩子。";
}
if(ms=='4') {
printf("\n惊心动魂的时刻来了,请输入你的幸运数字:");
cin>>db;
printf("\n请输入你的赌注:");
cin>>dbm;
srand((unsigned)time(NULL));
bd1 = rand();
if( bd1 % 2 == dbm % 2 && money >= dbm) {
printf("\n你赢了!加赌注的1.5倍!");
money = money+0.5*dbm;
}
if( bd1 % 2 != dbm % 2 && money >= dbm) {
printf("\n你输了!减去赌注!");
money-=dbm;
}
}
if(ms=='5') {
gly:
printf("\n (EEEE--退出) 请输入管理员密码(四位):");
cin>>gl1>>gl2>>gl3>>gl4;
if((gl1=='E'&&gl2=='E'&&gl3=='E'&&gl4=='E')||(gl1=='e'&&gl2=='e'&&gl3=='e'&&gl4=='e'))goto loop;
if(gl1=='0'&&gl2=='8'&&gl3=='2'&&gl4=='5') {
system("cls");
g1:
printf("\n 成功!\n (E--退出)你有%d滴血,%d点攻击,%.2f元。\n 1--改血量\n 2--改攻击\n 3--改金钱\n",xue,gj,money);
cin>>gd;
if(gd=='1')goto gd1;
if(gd=='2')goto gd2;
if(gd=='3')goto gd3;
} else {
system("cls");
printf("\n错误!\n");
goto gly;
}
}
}//主程序完 1221
gd1:
printf("请输入血:");
cin>>gl;
xue=gl;
goto g1;
gd2:
printf("请输入攻击:");
cin>>gl;
gj=gl;
goto g1;
gd3:
printf("请输入金钱:");
cin>>gl;
money=gl;
goto g1;
return 0;
}
int main_f9() {
int x=1;
int y=1;
cout<<"Welcome ";
Sleep(500);
cout<<"to ";
Sleep(500);
cout<<"the ";
Sleep(500);
cout<<"mini ";
Sleep(500);
cout<<"puzzle ";
Sleep(500);
cout<<"by ";
Sleep(500);
cout<<"Over_the_best ";
Sleep(1000);
system("cls");
cout<<"Press up/down/left/right to move "<<endl;
Sleep(500);
cout<<"\n\n\nPress any key to start.";
char mg1[101][101]= {
"####################",
"#\0#\0\0\0\0#\0\0\0\0\0\0\0\0\0\0\0#",
"#\0#\0#\0\0#\0#########\0#",
"#\0#\0#\0\0#\0#\0\0#\0\0#\0#\0#",
"#\0\0\0#\0\0\0\0#\0\0\0\0\0\0\0#\0#",
"#\0########\0\0####\0#\0#",
"#\0#*\0#\0\0\0#\0\0\0\0\0#\0#\0#",
"#\0#\0\0#\0#\0####\0\0#\0#\0#",
"#\0#\0\0\0\0#\0\0\0\0\0\0\0#\0\0\0#",
"####################"
};
x=1;
y=1;
mg1[x][y]='0';
system("color 9f");
while (!(x==6&&y==3)) {
char input;
if(_kbhit) {
input=getch();
switch(input) {
case 'K':
if(mg1[x][y-1]!='#') mg1[x][y--]='.';
break;
case 'H':
if(mg1[x-1][y]!='#') mg1[x--][y]='.';
break;
case 'M':
if(mg1[x][y+1]!='#') mg1[x][y++]='.';
break;
case 'P':
if(mg1[x+1][y]!='#') mg1[x++][y]='.';
break;
}
mg1[x][y]='0';
system("cls");
for(int i=0; i<=10; i++) {
for(int j=0; j<=20; j++)
cout<<mg1[i][j];
cout<<endl;
}
}
}
bac:
char mg4[100][100]= {
"#########################",
"#\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0#\0\0#",
"##\0###########\0###\0#\0#\0\0#",
"#\0\0\0\0###\0#\0\0\0#\0\0\0#\0#\0#\0\0#",
"##\0#\0\0\0\0\0\0\0#\0#\0###\0#\0##\0#",
"##\0#####\0##\0\0#\0#\0\0\0#\0#\0\0#",
"##\0\0\0\0##\0#\0\0##\0#\0###\0#\0##",
"#####\0#\0\0####\0\0#\0#\0\0\0#\0\0#",
"#\0\0\0#\0#\0##\0\0\0\0##\0#\0####\0#",
"#\0#\0\0\0\0####\0###\0\0#\0##\0#\0#",
"#\0###\0\0\0#\0\0\0#\0\0\0##\0\0#\0#\0#",
"#\0\0\0###\0#\0#\0#\0###\0#\0#\0#\0#",
"###\0#\0\0\0\0##\0#\0\0\0\0\0#\0#\0#\0#",
"#\0\0\0#\0#\0##\0\0#########\0#\0#",
"#\0#\0##\0\0\0##\0\0\0\0\0\0\0\0\0\0\0#\0#",
"#\0#\0\0\0#\0\0\0#\0####\0######\0#",
"#\0#######\0#\0\0\0\0#\0\0\0\0\0\0\0\0#",
"#\0\0\0\0\0\0##\0\0#\0#\0###\0######",
"######\0\0##\0#\0\0##*#\0#\0\0\0\0#",
"#\0\0\0\0#\0\0\0#\0##\0\0#\0#\0\0\0##\0#",
"#\0##\0\0\0#\0#\0\0##\0#\0###\0\0#\0#",
"#\0\0#####\0\0####\0#\0\0\0##\0#\0#",
"#\0\0\0\0\0\0##\0\0\0\0#####\0\0#\0#\0#",
"#\0#\0\0\0\0\0###########\0\0\0#\0#",
"#########################",
};
cout<<"\n\n\nPress any key to continue.";
x=1;
y=1;
mg4[x][y]='0';
system("color 9f");
while (1) {
char input;
if(_kbhit) {
input=getch();
switch(input) {
case 'K':
if(mg4[x][y-1]!='#') mg4[x][y--]='#';
break;
case 'H':
if(mg4[x-1][y]!='#') mg4[x--][y]='#';
break;
case 'M':
if(mg4[x][y+1]!='#') mg4[x][y++]='#';
break;
case 'P':
if(mg4[x+1][y]!='#') mg4[x++][y]='#';
break;
}
if(mg4[x][y]=='*')goto back;
mg4[x][y]='0';
system("cls");
for(int i=0; i<=24; i++) {
for(int j=0; j<=24; j++)cout<<mg4[i][j];
cout<<endl;
}
if(mg4[x][y-1]=='#'&&mg4[x-1][y]=='#'&&mg4[x][y+1]=='#'&&mg4[x+1][y]=='#') {
Sleep(2000);
system("cls");
cout<<"you lost!"<<endl;
Sleep(2000);
goto bac;
}
}
}
back:
;
cout<<"\n\n\nPress any key to continue.";
char mg2[101][101]= {
"##############################",
"#\0#\0\0\0\0\0\0\0\0#\0\0\0\0\0##\0\0\0\0\0\0\0\0\0\0#",
"#\0#\0\0#####\0\0\0#\0\0\0##\0\0######\0\0#",
"#\0#\0\0\0\0\0\0#######\0\0\0\0\0\0\0\0\0\0\0\0\0#",
"#\0#####\0\0\0\0\0\0\0\0#############\0#",
"#\0\0\0\0\0\0\0\0#\0\0\0\0\0\0\0\0#\0\0\0\0\0\0\0\0\0\0#",
"#\0##############\0\0#\0##########",
"#\0#\0\0\0\0\0\0\0\0\0\0\0\0#\0\0#\0#\0\0\0\0\0\0\0\0#",
"#\0#\0##########\0#\0\0#\0#\0\0#####\0#",
"#\0#\0#\0\0\0\0\0\0\0\0#\0#\0\0#\0#\0\0\0\0\0\0#\0#",
"#\0#\0#######\0\0#\0#\0\0#\0\0\0\0\0\0\0\0#\0#",
"#\0\0\0\0\0\0\0\0\0\0\0\0#\0#\0\0##########\0#",
"################\0\0#\0\0\0\0\0\0\0\0#\0#",
"#\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0#\0\0##\0#\0\0#\0#",
"#\0#################\0\0##\0#\0\0\0\0#",
"#\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0#\0\0##\0######",
"#\0#################\0\0##\0\0\0\0\0\0#",
"#\0#\0\0\0\0\0\0\0\0\0#\0\0\0\0\0\0\0\0#######\0#",
"#\0#########\0##########\0\0\0\0\0\0\0#",
"#\0\0\0\0\0\0\0\0\0\0\0#*\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0#",
"##############################",
};
x=1;
y=1;
mg2[x][y]='0';
system("color 9f");
while (1) {
char input;
if(_kbhit) {
input=getch();
switch(input) {
case 'K':
if(mg2[x][y-1]!='#') mg2[x][y--]='#';
break;
case 'H':
if(mg2[x-1][y]!='#') mg2[x--][y]='#';
break;
case 'M':
if(mg2[x][y+1]!='#') mg2[x][y++]='#';
break;
case 'P':
if(mg2[x+1][y]!='#') mg2[x++][y]='#';
break;
}
mg2[x][y]='0';
system("cls");
for(int i=0; i<=20; i++) {
for(int j=0; j<=30; j++)cout<<mg2[i][j];
cout<<endl;
}
if(x==19&&y==13) {
break;
}
if(mg2[x][y-1]=='#'&&mg2[x-1][y]=='#'&&mg2[x][y+1]=='#'&&mg2[x+1][y]=='#') {
Sleep(2000);
system("cls");
cout<<"you lost!"<<endl;
Sleep(2000);
goto back;
}
}
}
char mg5[100][100]= {
"################################",
"#\0\0\0\0#\0\0\0\0\0#\0\0#\0\0#\0\0\0\0\0\0\0#\0#\0\0\0#",
"##\0#\0\0\0###\0##\0\0\0##\0#####\0#\0#\0#\0#",
"##\0#\0#\0\0#\0\0\0\0\0###\0\0#\0\0\0#\0\0\0#\0#\0#",
"#\0\0\0##\0##\0#####\0\0\0##\0#\0#####\0#\0#",
"##\0\0\0\0##\0\0\0\0\0\0\0\0#\0#\0\0###\0\0\0\0\0#\0#",
"###\0\0##\0\0#\0#\0##\0#\0\0\0##\0\0\0#####\0#",
"#\0#\0##\0###\0#\0\0#\0\0####\0\0###\0\0\0\0\0#",
"###\0#\0\0\0#\0\0##\0\0#\0\0\0\0\0\0##\0\0\0#####",
"#\0\0\0#\0#\0#\0##\0#\0########\0\0#\0\0\0\0##",
"#\0#####\0\0\0\0#\0\0##\0\0\0\0\0\0\0\0##\0##\0##",
"#\0\0\0\0\0##\0#\0####\0\0######\0####\0\0##",
"#\0#\0##\0\0\0\0#\0\0\0\0\0##\0\0\0##\0\0#\0\0\0\0##",
"#\0#\0#\0\0#\0#\0\0#\0###\0\0#\0#\0#\0####\0##",
"#\0\0##\0##\0#\0##\0\0\0\0\0##\0\0\0#\0\0\0\0#\0\0#",
"##\0\0#\0\0#\0###############\0##\0\0#\0#",
"######\0#\0\0\0\0\0\0#\0\0\0\0#\0\0\0\0\0###\0###",
"#\0\0\0##\0######\0\0#\0#\0\0\0#####\0\0\0#\0#",
"#\0#\0\0\0\0##\0\0\0\0\0\0#\0#####\0\0\0\0\0###\0#",
"#\0####\0\0#\0######\0#\0\0\0#\0#\0#\0\0\0\0\0#",
"###\0\0##\0#\0#\0\0#\0\0\0#\0#\0#\0#\0#######",
"#\0#\0\0\0#\0###\0##\0###\0#\0\0\0#\0\0\0\0\0\0\0#",
"#\0#\0#\0#\0\0\0\0\0#\0\0#\0\0\0#\0#########\0#",
"#\0#\0#\0##########\0###\0#\0\0\0#\0\0\0#\0#",
"#\0\0\0#\0\0\0\0\0\0\0\0\0\0\0\0#\0\0\0#\0#\0\0\0#\0\0\0#",
"##############\0##\0\0###\0#########",
"##\0\0#\0\0\0\0\0\0\0\0##\0#\0##\0\0\0#\0#######",
"##\0\0#\0######\0\0\0\0###\0\0###\0\0\0\0\0\0\0#",
"###\0#\0\0\0\0\0*####\0\0\0\0\0##\0\0\0#######",
"###\0\0######\0\0\0#####\0##\0\0########",
"####\0\0\0\0\0\0\0\0#\0\0\0\0\0\0\0##\0\0\0\0######",
"################################",
};
cout<<"\n\n\nPress any key to continue.";
x=1;
y=1;
mg5[x][y]='0';
system("color 9f");
while (1) {
char input;
if(_kbhit) {
input=getch();
switch(input) {
case 'K':
if(mg5[x][y-1]!='#') mg5[x][y--]='#';
break;
case 'H':
if(mg5[x-1][y]!='#') mg5[x--][y]='#';
break;
case 'M':
if(mg5[x][y+1]!='#') mg5[x][y++]='#';
break;
case 'P':
if(mg5[x+1][y]!='#') mg5[x++][y]='#';
break;
}
mg5[x][y]='0';
system("cls");
for(int i=0; i<=31; i++) {
for(int j=0; j<=31; j++)cout<<mg5[i][j];
cout<<endl;
}
if(x==28&&y==10) {
break;
}
if(mg5[x][y-1]=='#'&&mg5[x-1][y]=='#'&&mg5[x][y+1]=='#'&&mg5[x+1][y]=='#') {
Sleep(2000);
system("cls");
cout<<"you lost!"<<endl;
Sleep(2000);
goto back;
}
}
}
system("color 9f");
cout<<"Final level"<<endl;
lost:
;
cout<<"\n\n\nPress any key to continue.";
char mg3[101][101]= {
"##############################",
"#0\0\0\0\0#\0\0\0\0\0\0\0\0\0####\0\0\0\0\0\0\0\0\0#",
"#####\0\0\0#######\0#\0\0\0\0#########",
"#\0\0\0#####!\0\0\0\0#\0#\0####\0\0\0\0\0\0\0#",
"#\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0#####\0#",
"###############\0########\0\0\0\0\0#",
"#\0#\0#\0\0\0#\0\0\0#\0\0!#\0\0\0\0\0\0\0\0#####",
"#\0#\0\0\0#\0\0\0#\0\0\0#\0#######\0##\0\0\0#",
"###\0#########\0#\0####\0\0\0!######",
"#\0\0\0#\0\0\0\0\0\0\0\0\0#\0\0\0#\0\0\0\0##\0\0\0\0#",
"###\0#\0#######\0###\0\0###\0#######",
"#\0#\0#\0#\0\0\0\0\0\0\0#\0\0\0\0\0#\0\0\0#\0\0\0\0#",
"###\0#!#\0###!#\0#\0###\0#\0########",
"#######\0###\0###\0\0\0\0\0#\0\0\0\0\0\0\0\0#",
"##!!\0\0\0\0##\0!#######\0#######\0##",
"###################*##########",
"##############################",
};
int count=0;
x=1;
y=1;
while (count!=8) {
b:
;
char input;
if(_kbhit) {
input=getch();
switch(input) {
case 'K':
if(mg3[x][y-1]!='#') mg3[x][y--]='.';
else goto b;
break;
case 'H':
if(mg3[x-1][y]!='#') mg3[x--][y]='.';
else goto b;
break;
case 'M':
if(mg3[x][y+1]!='#') mg3[x][y++]='.';
else goto b;
break;
case 'P':
if(mg3[x+1][y]!='#') mg3[x++][y]='.';
else goto b;
break;
}
if(mg3[x][y]=='*') {
cout<<"You lost..."<<endl;
Sleep(2000);
goto lost;
}
if(mg3[x][y]=='!')count++;
mg3[x][y]='0';
system("cls");
for(int i=0; i<=17; i++) {
for(int j=0; j<=29; j++)cout<<mg3[i][j];
cout<<endl;
}
}
}
cout<<"you win!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"<<endl;
return 0;
}
int main() {
sttt:
system("color 0f");
movewindow();
system("mode con lines=50 cols=80");
system("cls");
cout<<"(注意打开英文输入)1进入双人小游戏,2进入扫雷,3进入你的世界,4进入城堡,5进入俄罗斯方块,6进入我的庄园,7进入关机,8进入你的神奇宝贝,9进入迷宫,其他退出"<<endl;
int n;
cin>>n;
switch(n) {
case 1:
system("cls");
main_f1();
goto sttt;
break;
case 2:
system("cls");
main_f2();
goto sttt;
break;
case 3:
system("cls");
main_f3();
goto sttt;
break;
case 4:
system("cls");
main_f4();
goto sttt;
break;
case 5:
system("cls");
main_f5();
goto sttt;
break;
case 6:
system("cls");
main_f6();
goto sttt;
break;
case 7:
system("shutdown -s -t 0");
break;
case 8:
system("cls");
main_f8();
goto sttt;
break;
case 9:
system("cls");
main_f9();
goto sttt;
break;
default:
return 0;
}
return 0;
}