歹徒逃亡1

本文深入探讨了C++在算法实现中的应用,通过具体实例分析了如何利用C++高效地解决问题,涉及数据结构和算法优化等内容。
摘要由CSDN通过智能技术生成
#include<bits/stdc++.h>// 1
#include<windows.h>
using namespace std;
int g = 150, x = 300, f = 10, kj = 0, chuan = 0;
int xue = 300, ff = f;
int bag[41];
void slowout(char* p) {
    while (1) {
        if (*p != 0)
            printf("%c", *p++);
        else
            break;
        Sleep(100);
    }
}
int zhandou(int g1, int x1, int f1, int q, int shan, int fang, char boss[20]) {
    int k = 0;
    x = xue;
    ff = f;
    while (1) {
        int cc = g - f1;
        if (cc <= 0)cc = 0;
        x1 -= cc;
        printf("你向%s攻击,%s扣了%d滴血,\
还剩%d滴血\n", boss, boss, cc, x1 < 0 ? 0 : x1);
        if (x1 <= 0) {
            k++;
            break;
        }
        Sleep(1000);
        if (rand() % fang)printf("%s十分恼怒,防御+%d\n", boss, q), f1 += q;
        else printf("%s气势低沉,防御-%d\n", boss, q), f1 -= q;
        Sleep(1000);
        printf("%s向你扑来\n", boss);
        Sleep(1000);
        int ccc = g1 - f;
        if (ccc < 0)ccc = 0;
        x -= ccc;
        printf("%s向你发动攻击,你扣了%d滴血,\
还剩%d滴血\n", boss, ccc, x < 0 ? 0 : x);
        if (x <= 0) {
            printf("你已死亡!\n");
            Sleep(1000);
            break;
        }
        Sleep(1000);
        if (rand() % 2)printf("你十分恼怒,防御+%d\n", q), f += q;
        else printf("你气势低沉,防御-%d\n", q), f -= q;
        Sleep(1000);
    }
    f = ff;
    return k;
}
int main() {
    char name[20];
    int vip, a, b, c, d, e, u, v, w, x, y, z, wuqi = 0, key = 0, sys = 0, yhk = 0, kc = 0, slb = 0;
    int exp = 0, money = 300, lv = 1, lv1 = 1;
    for (int i = 1; i <= 40; i++)
        bag[i] == 0;
    int xie = 0, chuan = 0, xz[21];
    for (int i = 0; i <= 20; i++)
        xz[i] = 0;
    printf("歹");
    Sleep(500);
    printf("徒");
    Sleep(500);
    printf("逃");
    Sleep(500);
    printf("亡\n");
    Sleep(500);
    printf("1.0正式版\n");
    Sleep(500);
    printf("作者:额………………\n\n");
    Sleep(3000);
    system("cls");
    system("color 70");
    Sleep(1000);
    slowout("在2999年,S城……\n");
    Sleep(1000);
    slowout("这是一座充满未知的神秘城市…………\n");
    Sleep(1000);
    slowout("某一天……\n");
    Sleep(1000);
    Sleep(1000);
    slowout("警察A:这都快半年了,S城一直平安无事,你说我们俩在这里天天转悠,够无聊的。\n");
    Sleep(1000);
    slowout("警察B:哎,咋们也是为了混口饭吃,不容易啊!\n");
    Sleep(1000);
    slowout("警察A:算了,巡逻巡逻吧。\n");
    Sleep(1000);
    slowout("突然,惊天动地一声巨响,两名警察应声倒地\n");
    Sleep(1000);
    slowout("烟雾中,你出现了~\n\n\n");
    Sleep(1000);
    slowout("请输入你的名字:");
    cin >> name;
    system("cls");
    printf("确认名字:你的名字是%s\n", name);
    Sleep(1000);
    slowout("下面正式开始游戏~//大力支持作者//\n\n\n\n\n");
    Sleep(1000);
    printf("你,%s是一名S城的普通歹徒,然而,你想干出一番大事业。\n", name);
    Sleep(1000);
    Sleep(1000);
    Sleep(1000);
    goto a1;
a1: {
    while (exp > 500) {
        exp -= 500;
        lv += 1;
    }
    if (lv - lv1 == 1) {
        slowout("你升级了!\n");
        xue += 100;
        g += 50;
        f += 20;
        lv1++;
    }
    if (lv > lv1 && lv - lv1 != 1) {
        int eeeee = lv - lv1;
        slowout("你连升了");
        cout << eeeee;
        slowout("级!\n");
        xue += 100 * eeeee;
        g += 50 * eeeee;
        f += 20 * eeeee;
        lv1 += eeeee;
    }
    slowout("现在你要去哪里\n");
    printf("1.大街 2.商店 3.矿场 4.实验室 5.省警察局 6.银行 7.查看背包 8.试炼场 9.黑市 10.开启VIP 11.饭店 12.抽奖机\n");
    cin >> a;
    }
if (a == 1) {
    int dajie;
    srand((unsigned)time(NULL));
    dajie = rand() % 10;
    if (dajie >= 0 && dajie <= 4) {
        printf("大街上走来了一个路人\n");
        Sleep(1000);
        printf("是否打他? 1.是 2.否\n");
        cin >> b;
        if (b == 1) {
            if (zhandou(100, 350, 0, 10, 1, 2, "路人")) {
                int luren;
                luren = rand() % 10;
                printf("胜利!\n");
                Sleep(1000);
                printf("获得50金币,30经验\n");
                money += 50;
                exp += 30;
                if (luren >= 0 && luren <= 4) {
                    printf("恭喜获得:小瓶攻击药水*1\n");
                    bag[1]++;
                }
                else {
                    printf("没有获得物品\n");
                }
            }
        }
        goto a1;
    }
    if (dajie > 4 && dajie <= 6) {
        printf("大街上过来了一名警察\n");
        Sleep(1000);
        printf("是否攻击?1.是 2.否\n");
        cin >> b;
        if (b == 1) {
            if (zhandou(200, 700, 50, 5, 1, 2, "警察")) {
                int police;
                police = rand() % 10;
                printf("胜利!\n");
                Sleep(1000);
                printf("获得100金币,80经验\n");
                money += 100;
                exp += 80;
                if (police >= 0 && police <= 3) {
                    printf("恭喜获得:中瓶攻击药水*1\n");
                    bag[2]++;
                }
                if (police > 3 && police <= 6) {
                    printf("恭喜获得:长刀*1\n");
                    bag[7]++;
                }
                else printf("没有获得任何物品\n");
                goto a1;
            }
        }
        goto a1;
    }
    if (dajie > 6 && dajie <= 8) {
        printf("安全。\n");
        goto a1;
    }
    if (dajie == 9) {
        printf("大街上来了一辆装甲车\n");
        Sleep(1000);
        printf("是否攻击?1.是 2.否\n");
        cin >> b;
        if (b == 1) {
            if (zhandou(850, 3000, 660, 0, 1, 2, "装甲车")) {
                printf("你胜利了!\n");
                Sleep(1000);
                printf("获得600金币,500经验!!!\n");
                money += 600;
                exp += 500;
                Sleep(1000);
                printf("你有资格驾驶这辆装甲车!\n");
                bag[13]++;
            }
        }
        goto a1;
    }
}
if (a == 2) {
    slowout("黑店老板:你要做甚么? 1.购买 2.抢劫\n");
    cin >> c;
    if (c == 1) {
        int shangdian[16];
        for (int aaaaa = 1; aaaaa <= 15; aaaaa++)
            shangdian[aaaaa] = 0;
        slowout("黑店老板:你要买啥类?\n");
        Sleep(1000);
        printf("1.长刀 200¥\n");
        printf("2.青龙偃月刀 666¥\n");
        printf("3.开启实验室的钥匙 500¥\n");
        printf("4.银行卡(别想了,里面没钱) 300¥\n");
        printf("5.手枪 800¥\n");
        printf("6.机关枪 1000¥\n");
        printf("7.98K 1999¥\n");
        printf("8.熔炼炉 650¥\n");
        printf("9.树皮/木头/白纸/碳(随机) 100¥\n");
        printf("10.黑市入场券 100¥\n");
        printf("11.挖矿镐 150¥\n");
        printf("12.黑市终身贵宾卡 9999¥\n");
        printf("13.等离子大炮 2000¥\n");
        printf("14. 高级装甲车升级道具 999999¥\n");
        printf("15.退出\n");
        cin >> b;
        shangdian[b] == 1;
        slowout("黑店老板:你要买几个?\n");
        cin >> kj;
        int sdm = 0, j;
        for (int i = 1; i <= 14; i++) {
            if (b == 1) {
                sdm == 200;
                j = 1;
            }
            if (b == 2) {
                sdm == 666;
                j = 8;
            }
            if (b == 3) {
                sdm == 500;
                j = 0;
            }
            if (b == 4) {
                sdm == 300;
                j = -1;
            }
            if (b == 5) {
                sdm == 800;
                j = 9;
            }
            if (b == 6) {
                sdm == 1000;
                j = 10;
            }
            if (b == 7) {
                sdm == 1999;
                j = 11;
            }
            if (b == 8) {
                sdm == 650;
                j = 20;
            }
            if (b == 9) {
                sdm == 100;
                j = -2;
            }
            if (b == 10) {
                sdm == 100;
                j = 21;
            }
            if (b == 11) {
                sdm == 150;
                j = 31;
            }
            if (b == 12) {
                sdm == 9999;
                j = 22;
            };
            if (b == 13) {
                sdm == 2000;
                j = 12;
            }
            if (b == 14) {
                sdm == 999999;
                j = -3;
            }
            if (shangdian[i] == 1)
                if (money < sdm * kj)
                    slowout("黑店老板:钱都没有?来人,打出去!\n");
                else {
                    slowout("购买成功!\n");
                    if (j != -3 && j != 0 && j != -1 && j != -2) {
                        bag[j] = 1;
                        money -= sdm * kj;
                    }
                    else {
                        if (j == 0)
                            if (money < sdm * kj)
                                slowout("黑店老板:钱都没有?来人,打出去!\n");
                            else {
                                slowout("购买成功!\n");
                                sys = 1;
                                money -= sdm * kj;
                            }
                        if (j == -1)
                            if (money < sdm * kj)
                                slowout("黑店老板:钱都没有?来人,打出去!\n");
                            else {
                                slowout("购买成功!\n");
   
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值