c++野外生存

C++ 制作生存游戏 今天给大家带来我耗时两年半制作的快乐生存游戏,你得生存下去,造出火箭逃脱。。。。。。上代码 阅读详情
//转自:https://www.luogu.com.cn/team/32221#main
//收藏者的温馨提示:部分情节作者没有更完就咕咕咕啦
//如果你编译报错,请点击工具-编译选项-勾选编译时加入以下命令,在下面的框中输入:-std=c++11,确定即可
#include <iostream>
#include <string>
#include <windows.h>
#include <conio.h>
#include <fstream>
#include <ctime>
#include <time.h>
#include <stdio.h>
using namespace std;
struct thing
{
   
   
    string type;
    string name;
    int attack;
    int defense;
    int health;
    int num;
    bool disposable;
    int sharp;
    int durability;
};
struct w
{
   
   
    string name;
    string b[100];
    int bnum;
};
int health = 1000, maxhealth = 1000, defense = 10, attack = 100;
int capacity = 0;
string name;
int nowway = 0, water = 0, maxwater = 10;
int bagi = 1, protectlevel;
string protect;
string canmakething[1000] = {
   
    "退出","木剑","木斧","木镐","工作台" };
int canmakethingi = 5;
string f[100] = {
   
   
    {
   
   "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"},
    {
   
   "+..................................................................................................+"},
    {
   
   "+..................................................................................................+"},
    {
   
   "+.........+............................................K...........................................+"},
    {
   
   "+.......FV+........................................................................................+"},
    {
   
   "+...................F..........T...................................................................+"},
    {
   
   "+........+................+.............+.............V.......................CF...................+"},
    {
   
   "+.......+..........................................................................................+"},
    {
   
   "+.............................................................+.H.+..............B.................+"},
    {
   
   "+......F.......+.......+............V............................+.................................+"},
    {
   
   "+...............V....+...............................................................Y.............+"},
    {
   
   "+....................F+.......+++............++....................................................+"},
    {
   
   "+.............................+C+.......o....I+.....o...................S..........F...............+"},
    {
   
   "+..........................................+++.....................................................+"},
    {
   
   "+.............................+.........................V..........................................+"},
    {
   
   "+.........Y...........H......+..........o.......+..A...........+...................................+"},
    {
   
   "+...........................+..................o+............++....G..............YV...............+"},
    {
   
   "+.....................................................+......+.I...................................+"},
    {
   
   "+......................+++.......................+++..........+....................................+"},
    {
   
   "+.....................+..U+......................V........+....+.............Y.....................+"},
    {
   
   "+.......H...........++...++........................................................................+"},
    {
   
   "+.......................+Y................++...................M...................................+"},
    {
   
   "+......................................+...G+...........T..........................................+"},
    {
   
   "+...H..............W............................................................Y..................+"},
    {
   
   "+..................................................................................................+"},
    {
   
   "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"},
};
bool isf[100][100];
int movex[4] = {
   
    0,-1,0,1 };
int movey[4] = {
   
    -1,0,1,0 };
//H巨坑 I铁矿 C煤矿 G金矿 o小镇 Y城市 V洞穴 S飞船 F战场 M沼泽 T钛矿 P前哨 B硫磺矿 K军事基地
int Outpostx[100], opxi = 0;
int Outposty[100], opyi = 0;
w way[100] = {
   
   
    {
   
   "池塘",{
   
   "进入森林","背包","状态","装备","制作"}, 5},
    {
   
   "帮助&设置",{
   
   "制造配方"},1}
};
int waynum = 2;
bool isw[100] = {
   
    true, false, false };
bool isb[100] = {
   
    true, false, false };
thing nowaxe, nowpickaxe, nowweapon, nowhoe;
thing bag[1000] = {
   
   
    {
   
   "退出","退出",0,0,0,0,false},
};
string outbutton()
{
   
   
    char c;
    int now = 0;
    for (int i = 0; i < 100; i++)
    {
   
   
        if (isb[i] == true)
        {
   
   
            now = i;
        }
    }
    while (1)
    {
   
   
        system("cls");
        for (int i = 0; way[i].name != ""; i++)
        {
   
   
            if (isw[i] == true)
            {
   
   
                cout << "*" << way[i].name << "*";
            }
            else
            {
   
   
                cout << " " << way[i].name << " ";
            }
        }
        cout << endl;
        for (int i = 0; way[nowway].b[i] != ""; i++)
        {
   
   
            if (isb[i] == true)
            {
   
   
                cout << ">" << way[nowway].b[i] << "<" << endl;
            }
            else
            {
   
   
                cout << " " << way[nowway].b[i] << " " << endl;
            }
        }
        c = _getch();
        if (c == 'w' && now > 0)
        {
   
   
            isb[now] = false;
            isb[now - 1] = true;
            now -= 1;
        }
        if (c == 's' && way[nowway].b[now + 1] != "")
        {
   
   
            isb[now] = false;
            isb[now + 1] = true;
            now += 1;
        }
        if (c == 'a' && nowway > 0)
        {
   
   
            isw[nowway] = false;
            isw[nowway - 1] = true;
            nowway -= 1;
            isb[now] = false;
            isb[0] = true;
        }
        if (c == 'd' && way[nowway + 1].name != "")
        {
   
   
            isw[nowway] = false;
            isw[nowway + 1] = true;
            nowway += 1;
            isb[now] = false;
            isb[0] = true;
        }
        if (c == 32)
        {
   
   
            return way[nowway].b[now];
        }
    }
    return "";
}
string outbag()
{
   
   
    char c;
    int now = 0;
    bool isbag[1000] = {
   
    true, false };
    while (1)
    {
   
   
        system("cls");
        for (int i = 0; bag[i].name != ""; i++)
        {
   
   
            if (isbag[i] == true)
            {
   
   
                cout << ">" << bag[i].name << "<";
            }
            else
            {
   
   
                cout << " " << bag[i].name << " ";
            }
            for (int j = 0; j < 20 - bag[i].name.size() - to_string(bag[i].num).size(); j++)
            {
   
   
                cout << " ";
            }
            cout << bag[i].num << "    " << bag[i].durability << endl;
        }
        c = _getch();
        if (c == 'w' && now > 0)
        {
   
   
            isbag[now] = false;
            isbag[now - 1] = true;
            now -= 1;
        }
        if (c == 's' && bag[now + 1].name != "")
        {
   
   
            isbag[now] = false;
            isbag[now + 1] = true;
            now += 1;
        }
        if (c == 32)
        {
   
   
            return bag[now].name;
        }
    }
    return 0;
}
bool skills[10];//勘察术 美食家 矿工 收集家 野蛮人 战士 铠甲人 医生 忍者
int fight(string hn, int hmh, int ha, int hd, int hh)
{
   
   
    while (1)
    {
   
   
        if (nowweapon.type == "剑") cout << "1,扎刺";
        else if (nowweapon.type == "刀") cout << "1,劈砍";
        else if (nowweapon.type == "机枪") cout << "1,扫射";
        else if (nowweapon.type == "手枪") cout << "1,射击";
        else if (nowweapon.type == "") cout << "1,拳击";
        bool is1 = false, is2 = false, is3 = false;
        int i1, i2, i3;
        for (int i = 0; i < 1000; i++)
        {
   
   
            if (bag[i].name == "手雷" && bag[i].num != 0)
            {
   
   
                cout << " 2,丢出[" << bag[i].num << "]";
                is1 = true;
                i1 = i;
                break;
            }
        }
        for (int i = 0; i < 1000; i++)
        {
   
   
            if (bag[i].name == "长矛" && bag[i].num != 0)
            {
   
   
                cout << " 3,投掷[" << bag[i].num << "]";
                is2 = true;
                i2 = i;
                break;
            }
        }
        for (int i = 0; i < 1000; i++)
        {
   
   
            if (bag[i].name == "熏肉" && bag[i].num != 0)
            {
   
   
                cout << " 4,吃肉[" << bag[i].num << "]";
                is3 = true;
                i3 = i;
                break;
            }
        }
        if (skills[7])
        {
   
   
            cout << "5,医治";
        }
        string which;
        cin >> which;
        int bullet = 0, missile = 0;
        for (int i = 0; i < 1000; i++)
        {
   
   
            if (bag[i].name == "子弹")
            {
   
   
                bullet = bag[i].num;
            }
            if (bag[i].name == "导弹")
            {
   
   
                missile = bag[i].num;
            }
            else if (bag[i].name == "")
            {
   
   
                break;
            }
        }
        if (which == "1")
        {
   
   
            if (nowweapon.type == "剑" || nowweapon.type == "刀" || nowweapon.type == "")
            {
   
   
                system("cls");
                cout << "\n\n\n\n\n";
                cout << "[" << health << "/" << maxhealth << "]@        E[" << hh << "/" << hmh << "]";
                Sleep(10);
                system("cls");
                cout << "\n\n\n\n\n";
                cout << "[" << health << "/" << maxhealth << "] @       E[" << hh << "/" << hmh << "]";
                Sleep(10);
                system("cls");
                cout << "\n\n\n\n\n";
                cout << "[" << health << "/" << maxhealth << "]  @      E[" << hh << "/" << hmh << "]";
                Sleep(10);
                system("cls");
                cout << "\n\n\n\n\n";
                cout << "[" << health << "/" << maxhealth << "]   @     E[" << hh << "/" << hmh << "]";
                Sleep(10);
                system("cls");
                cout << "\n\n\n\n\n";
                cout << "[" << health << "/" << maxhealth << "]    @    E[" << hh << "/" << hmh << "]";
                Sleep(10);
                system("cls");
                cout << "\n\n\n\n\n";
                cout << "[" << health << "/" << maxhealth << "]     @   E[" << hh << "/" << hmh << "]";
                Sleep(10);
                system("cls");
                cout << "\n\n\n\n\n";
                cout << "[" << health << "/" << maxhealth << "]      @  E[" << hh << "/" << hmh << "]";
                Sleep(10);
                system("cls");
                cout << "\n\n\n\n\n";
                cout << "[" << health << "/" << maxhealth << "]       @ E[" << hh << "/" << hmh << "]";
                Sleep(10);
                system("cls");
                cout << "\n\n\n\n\n";
                cout << "[" << health << "/" << maxhealth << "]        @E[" << hh << "/" << hmh << "]";
                if (skills[5]) hh -= (attack + nowweapon.attack) * 2 - hd;
                else hh -= attack + nowweapon.attack - hd;
                Sleep(10);
                system("cls");
                cout << "\n\n\n\n\n";
                cout << "[" << health << "/" << maxhealth << "]      @  E[" << hh << "/" << hmh << "]";
                Sleep(10);
                system("cls");
                cout << "\n\n\n\n\n";
                cout << "[" << health << "/" << maxhealth << "]    @    E[" << hh << "/" << hmh << "]";
                Sleep(10);
                system("cls");
                cout << "\n\n\n\n\n";
                cout << "[" << health << "/" << maxhealth << "]  @      E[" << hh << "/" << hmh << "]";
                Sleep(10);
                system("cls");
                cout << "\n\n\n\n\n";
                cout << "[" << health << "/" << maxhealth << "]@        E[" << hh << "/" << hmh << "]";
            }
            else if (nowweapon.name == "激光步枪" || bullet > 0 || (nowweapon.name == "火箭筒" && missile > 0))
            {
   
   
                system("cls");
                cout << "\n\n\n\n\n";
                cout << "[" << health << "/" << maxhealth << "]@        E[" << hh << "/" << hmh << "]";
                Sleep(10);
                system("cls");
                cout << "\n\n\n\n\n";
                cout << "[" << health << "/" << maxhealth << "]@o       E[" << hh << "/" << hmh << "]";
                Sleep(10);
                system("cls");
                cout << "\n\n\n\n\n";
                cout << "[" << health << "/" << maxhealth << "]@ o      E[" << hh << "/" << hmh << "]";
                Sleep(10);
                system("cls");
                cout << "\n\n\n\n\n";
                cout << "[" << health << "/" << maxhealth << "]@  o     E[" << hh << "/" << hmh << "]";
                Sleep(10);
                system("cls");
                cout << "\n\n\n\n\n";
                cout << "[" << health << "/" << maxhealth << "]@   o    E[" << hh << "/" << hmh << "]";
                Sleep(10);
                system("cls");
                cout << "\n\n\n\n\n";
                cout << "[" << health << "/" << maxhealth << "]@    o   E[" << hh << "/" << hmh << "]";
                Sleep(10);
                system("cls");
                cout << "\n\n\n\n\n";
                cout << "[" << health << "/" << maxhealth << "]@     o  E[" << hh << "/" << hmh << "]";
                Sleep(10);
                system("cls");
                cout << "\n\n\n\n\n";
                cout << "[" << health << "/" << maxhealth << "]@      o E[" << hh << "/" << hmh << "]";
                Sleep(10);
                system("cls");
                cout << "\n\n\n\n\n";
                cout << "[" << health << "/" << maxhealth << "]@       oE[" << hh << "/" << hmh << "]";
                if (skills[5]) hh -= (attack + nowweapon.attack) * 2 - hd;
                else hh -= attack + nowweapon.attack - hd;
                Sleep(10);
                system("cls");
                cout << "\n\n\n\n\n";
                cout << "[" << health << "/" << maxhealth << "]@        E[" << hh << "/" << hmh << "]";
            }
            else if (bullet <= 0 || (nowweapon.name == "火箭筒" && missile <= 0))
            {
   
   
                MessageBox(0, TEXT("没弹药了..."), TEXT("重要提示"), MB_OK);
            }
        }
        else if (which == "2" && is1)
        {
   
   
            hh -= 500;
            system("cls");
            cout << "砰!";
            Sleep(1000);
            system("cls");
            cout << "[" << health << "/" << maxhealth << "]@        E[" << hh << "/" << hmh << "]";
            bag[i1].num--;
        }
        else if (which == "3" && is2)
        {
   
   
            system("cls");
            cout << "\n\n\n\n\n";
            cout << "[" << health << "/" << maxhealth << "]@        E[" << hh << "/" << hmh << "]";
            Sleep(10);
            system("cls");
            cout << "\n\n\n\n\n";
            cout << "[" << health << "/" << maxhealth << "]@>       E[" << hh << "/" << hmh << "]";
            Sleep(10);
            system("cls");
            cout << "\n\n\n\n\n";
            cout << "[" << health << "/" << maxhealth << "]@->      E[" << hh << "/" << hmh << "]";
            Sleep(10);
            system("cls");
            cout << "\n\n\n\n\n";
            cout << "[" << health << "/" << maxhealth << "]@ ->     E[" << hh << "/" << hmh << "]";
            Sleep(10);
            system("cls");
            cout << "\n\n\n\n\n";
            cout << "[" << health << "/" << maxhealth << "]@  ->    E[" << hh << "/" << hmh << "]";
            Sleep(10);
            system("cls");
            cout << "\n\n\n\n\n";
            cout << "[" << health << "/" << maxhealth << "]@   ->   E[" << hh << "/" << hmh << "]";
            Sleep(10);
            system("cls");
            cout << "\n\n\n\n\n";
            cout << "[" << health << "/" << maxhealth << "]@    ->  E[" << hh << "/" << hmh << "]";
            Sleep(10);
            system("cls");
            cout << "\n\n\n\n\n";
            cout << "[" << health << "/" << maxhealth << "]@     -> E[" << hh << "/" << hmh << "]";
            Sleep(10);
            system("cls");
            cout << "\n\n\n\n\n";
            cout << "[" << health << "/" << maxhealth << "]@      ->E[" << hh << "/" << hmh << "]";
            hh -= 200 - hd;
            Sleep(10);
            system("cls");
            cout << "\n\n\n\n\n";
            cout << "[" << health << "/" << maxhealth << "]@        E[" << hh << "/" << hmh << "]";
            bag[i2].num--;
        }
        else if (which == "4" && is3)
        {
   
   
            if (skills[2])
            {
   
   
                cout << "生命+1000";
                health += 1000;
                if (health > maxhealth)
                {
   
   
                    health = maxhealth;
                }
            }
            else
            {
   
   
                cout << "生命+500";
                health += 500;
                if (health > maxhealth)
                {
   
   
                    health = maxhealth;
                }
            }
            bag[is3].num--;
        }
        else if (which == "5" && skills[7])
        {
   
   
            cout << "生命+1500";
            health += 1500;
            if (health > maxhealth)
            {
   
   
                health = maxhealth;
            }
        }
        if (hh <= 0)
        {
   
   
            cout << "对方死亡";
            Sleep(1000);
            return 1;
        }
        system("cls");
        cout << "\n\n\n\n\n";
        cout << "[" << health << "/" << maxhealth << "]@        E[" << hh << "/" << hmh << "]";
        Sleep(10);
        system("cls");
        cout << "\n\n\n\n\n";
        cout << "[" << health << "/" << maxhealth << "]@       E [" << hh << "/" << hmh << "]";
        Sleep(10);
        system("cls");
        cout << "\n\n\n\n\n";
        cout << "[" << health << "/" << maxhealth << "]@      E  [" << hh << "/" << hmh << "]";
        Sleep(10);
        system("cls");
        cout << "\n\n\n\n\n";
        cout << "[" << health << "/" << maxhealth << "]@     E   [" << hh << "/" << hmh << "]";
        Sleep(10);
        system("cls");
        cout << "\n\n\n\n\n";
        cout << "[" << health << "/" << maxhealth << "]@    E    [" << hh << "/" << hmh << "]";
        Sleep(10);
        system("cls");
        cout << "\n\n\n\n\n";
        cout << "[" << health << "/" << maxhealth << "]@   E     [" << hh << "/" << hmh << "]";
        Sleep(10);
        system("cls");
        cout << "\n\n\n\n\n";
        cout << "[" << health << "/" << maxhealth << "]@  E      [" << hh << "/" << hmh << "]";
        Sleep(10);
        system("cls");
        cout << "\n\n\n\n\n";
        cout << "[" << health << "/" << maxhealth << "]@ E       [" << hh << "/" << hmh << "]";
        Sleep(10);
        system("cls");
        cout << "\n\n\n\n\n";
        cout << "[" << health << "/" << maxhealth << "]@E        [" << hh << "/" << hmh << "]";
        if (skills[8])
        {
   
   
            if (rand() % 3 == 2) health -= ha + -defense;
        }
        else if (rand() % 2) health -= ha + -defense;
        Sleep(10);
        system("cls");
        cout << "\n\n\n\n\n";
        cout << "[" << health << "/" << maxhealth << "]@  E      [" << hh << "/" << hmh << "]";
        Sleep(10);
        system("cls");
        cout << "\n\n\n\n\n";
        cout << "[" << health << "/" << maxhealth << "]@    E    [" << hh << "/" << hmh << "]";
        Sleep(10);
        system("cls");
        cout << "\n\n\n\n\n";
        cout << "[" << health << "/" << maxhealth << "]@      E  [" << hh << "/" << hmh << "]";
        Sleep(10);
        system("cls");
        cout << "\n\n\n\n\n";
        cout << "[" << health << "/" << maxhealth << "]@        E[" << hh << "/" << hmh << "]";
        Sleep(1000);
        cout << endl;
        if (health <= 0)
        {
   
   
            cout << "你死亡";
            Sleep(1000);
            return 0;
        }
    }
    return 0;
}
void slowly(const char* p)
{
   
   
    while (1)
    {
   
   
        if (*p != 0)
        {
   
   
            printf("%c", *p++);
        }
        else
        {
   
   
            break;
        }
        Sleep(75);
    }
}
int welcome()
{
   
   
    cout << "野外生存1.1.0 (不支持存档)" << endl;
    cout << "" << endl;
    cout << "" << endl;
    cout << "" << endl;
    cout << "" << endl;
    cout << "         本页面会持续更新...   " << endl;
    cout << "" << endl;
    cout << "" << endl;
    cout << "" << endl;
    cout << "" << endl;
    _getch();
    return 0;
}
int start()
{
   
   
    system("cls");
    cout << "□□□□□□■□□□□□□□□□□□□□□□□□□□□□" << endl;
    cout << "□□□□□□■■□□□□□□□□□□□□□□□□□■□□" << endl;
    cout << "□□□□□□■■■□□□□□□□□□□□□□□□■■□□" << endl;
    cout << "□□□■■■■■■■■■■■■■■■□□□□■■■■□□" << endl;
    cout << "□□■□■□■□■□■□■□■□■□■■■■■■■■□□" << endl;
    cout << "□□□■■■■■■■■■■■■■■■■■■■■■■□□□" << endl;
    cout << "□□□□□□□□■■■■■□□□□□□□□□□□□□□□" << endl;
    cout << "□□□□□□□□□■■■■■□□□□□□□□□□□□□□" << endl;
    cout << "□□□□□□□□□□□■■■□□□□□□□□□□□□□□" << endl;
    cout << "□□□□□□□□□□□□■■■□□□□□□□□□□□□□" << endl;
    cout << "□□□□□□□□□□□□□■■■□□□□□□□□□□□□" << endl;
    slowly("一天,你坐着飞机,正打算去美国...");
    Sleep(1000);
    system("cls");
    cout << "□□□□□□■□□□□□□□□□□□□□□□□□□□□□" << endl;
    cout << "□□□□□□■■□□□□□□□□□□□□□□□□□■□□" << endl;
    cout << "□□□□□□■■■□□□□□□□□□□□□□□□■■□□" << endl;
    cout << "□□□■■■■■■■■■■■■■■■□□□□■■■■□□" << endl;
    cout << "□□■□■□■□■□■□■□■□■□■■■■■■■■□□" << endl;
    cout << "□□□■■■■■■■■■■■■■■■■■■■■■■□□□" << endl;
    cout << "□□□□□□□□■■■■■□□□□□□□□□□□□□□□" << endl;
    cout << "□□□□□□□□□■■■■■□□□□□□□□□□□□□□" << endl;
    cout << "□□□□□□□□□□□■■■□□□□□□□□□□□□□□" << endl;
    cout << "□□□□□□□□□□□□■■■□□□□□□□□□□□□□" << endl;
    cout << "□□□□□□□□□□□□□■■■□□□□□□□□□□□□" << endl;
    slowly("一边看着电影,一边喝着饮料");
    Sleep(1000);
    system("cls")
C++制作生存小游戏 生存游戏,想必大家都了解过,不过想用Dev来做那些画质精美的游戏,那显然是不太可能。 于是文字游戏便得到了开发。 阅读详情

相关推荐

野外工厂应急现场跑大模型:便携AI工作站实战指南

边缘大模型推理是指在无网、弱网、高湿、宽温等受限环境下,于本地设备完成大语言模型的加载、量化、推理与轻量微调的技术实践。其核心原理在于显存带宽与容量的精准匹配、Linux实时内核裁剪、GGUF格式模型部署及llama.cpp等轻量推理引擎的深度适配。技术价值体现在摆脱云端依赖、保障决策实时性与系统鲁棒性,广泛应用于电力巡检、工业声纹诊断、应急指挥等一线场景。本文聚焦‘移动便携AI工作站’这一关键载体,结合Qwen2系列模型实测,系统解析从硬件选型(如GDDR6 vs GDDR6X)、软件栈优化(PREEMP

weixin_27419879的博客 118

手机本地跑大模型:Termux+llama.cpp+GGUF终端推理实战

大模型终端部署是指将语言模型在无云依赖、无GPU的移动设备上完成完整推理的过程,其核心原理在于CPU级优化、量化计算与内存映射技术的协同。通过ARM64 NEON指令加速、Q4_K_M等精细化量化策略及GGUF格式的mmap按需加载,显著降低内存占用与延迟,实现离线、低功耗、高隐私的AI能力下沉。该技术已广泛应用于现场运维、野外勘探、离线教育及政务金融等强安全场景,成为边缘智能的关键基础设施。本文聚焦安卓平台,详解Termux构建Linux运行时、llama.cpp编译适配与GGUF模型实操部署全链路。

weixin_34037515的博客 401

洛谷小游戏大全(用洛谷的人都得知道)

洛谷小游戏大全(用洛谷的人都得知道)

小天狼星_布莱克 的博客 6万+

C++生存游戏

#include<bits/stdc++.h> #include<windows.h> using namespace std; int choice; int a=0,b=0,c=0,d=0; int user_input; void S(int Color) { HANDLE hCon=GetStdHandle(STD_OUTPUT_HANDLE); SetConsoleTextAttribute(hCon,Color); } void wait() { Sleep(100); user_input=getchar(); } void cls() { Sleep(100); system("cls"); } int main(int argc, char *argv[]) { S(172); start:cls(); goto a1; gameover:printf("游戏结束。"); printf("按回车键继续"); user_input=getchar(); goto start; a1:printf("现在游戏开始。"); user_input=getchar(); printf("一天,你正在开飞机经过一片雪山区。"); wait(); printf("忽然你的操作系统失控了,飞机直直地坠入山中。"); wait(); printf("你朝两旁看了看,左边是雪地,右边是树林。而你正前方是悬崖,所以你不得不转弯。\n1-左转。\n2-右转。\n"); s1:wait(); switch(user_input) { case'1':goto a8; case'2':goto a13; default:goto s1; } a2:cls(); printf("你下了飞机,走向树林。"); wait(); printf("过了一会儿,你感到又饿又冷,就喝了一点威士忌,坐下休息。"); wait(); printf("但是,威士忌并没有让你觉得温暖。你只是觉得很冷、很冷。\n"); goto gameover; a3:cls(); printf("你吃了一些果实,还摘了一些放在口袋,想晚一点吃。"); wait(); printf("过了一会儿,你的肚子剧烈的痛起来。这时,你才意识到,果子有毒!\n"); goto gameover; a4:cls(); printf("你是否要继续往隧道里走?\n1-是。\n2-不了。\n"); s4:wait(); switch(user_input) { case'1':goto a18; case'2':goto a22; default:goto s4; } a5:cls(); printf("你能带三件东西下飞机。请选择:\n1-香蕉、打火机、外套。\n2-威士忌、外套、匕首。\n"); s5:wait(); switch(user_input) { case'1':goto a10; case'2':goto a2; default:goto s5; } a6:cls(); printf("你走到了隧道里,隧道里很黑,忽然你被一个东西绊倒了。\n"); wait(); printf("你爬起来,看了看地上的东西,原来是一条麻绳。\n1-捡起来。\n2-置之不理。\n"); s6:wait(); switch(user_input) { case'1':goto a11; case'2':goto a23; default:goto s6; } a7:cls(); printf("你呆在飞机里,感到越来越冷,你不得不离开了飞机。\n"); goto a5; a8:cls(); printf("随着“噗”地一声闷响,你的飞机安全降落在雪地上。"); wait(); printf("你要离开飞机去找东西吗?\n1-离开。\n2-待着。\n"); s8:wait(); switch(user_input) { case'1':goto a5; case'2':goto a7; default:goto s8; } a9:cls(); printf("你走出了隧道,继续走。\n"); wait(); printf("你来到了一个山谷前。"); wait(); printf("要走过去吗?\n1-走。\n2-不走。\n"); s9:wait(); switch(user_input) { case'1':goto a17; case'2':goto a12; default:goto s9; } a10:cls(); printf("你下了飞机,漫无目的地寻找食物。\n"); wait(); printf("你看到了一棵树,树上结着一种你从未见过的果子。\n1-吃一点。\n2-离开。\n"); s10:wait(); switch(user_input) { case'1':goto a3; case'2':goto a15; default:goto s10; } a11:cls(); printf("你捡起了绳子,发现它很长。"); a++; wait(); wait(); goto a22; a12:cls(); printf("你没有走进山谷,而是继续走。\n"); wait(); printf("很快,你就因饥饿死去了。\n"); wait(); goto gameover; a13:cls(); printf("“轰”,你的飞机撞上了树,爆炸了。"); wait(); goto gameover; a14:cls(); printf("你追着飞机跑。但是,飞机比你快太多了,你没有追上。"); wait(); printf("你很累很累,倒在了地上。"); wait(); printf("你死于虚脱。\n"); wait(); goto gameover; a15:cls(); printf("你没有吃果子,而是继续走。你走了很久,来到一个隧道口。\n1-进去。\n2-不进去。\n"); s15:wait(); switch(user_input) { case'1':goto a6; case'2':goto a21; default:goto s15; } a16:cls(); printf("你捞起了很多鱼,找了些树枝,烤了鱼来吃。"); wait(); printf("你觉得好多了。"); wait(); printf("这时,天空中传来嗡嗡的响声。你抬头一看,有飞机!\n1-追着飞机跑。\n2-点篝火。\n"); s16:wait(); switch(user_input) { case'1':goto a14; case'2':goto a20; default:goto s16; } a17:cls(); printf("你走了很久,有些体力不支,于是你把香蕉吃了。"); wait(); printf("你走了很久,来到了一个废弃矿坑边。\n1-探索一下。\n2-离开。\n"); s17:wait(); switch(user_input) { case'1':goto a24; case'2':goto a19; default:goto s17; } a18:cls(); printf("你继续往隧道里走,你感觉呼吸越来越难受。\n"); wait(); wait(); printf("你死于窒息。\n"); wait(); goto gameover; a19:cls(); printf("你来到了一个冰封的湖边。"); wait(); if(a==1) { if(b==1) { printf("你用麻绳织了个渔网,用锤子砸破冰面,试图捞上一些鱼。\n"); wait(); goto a16; } else { printf("你用麻绳织了个渔网,却无法打破冰面。你无奈地望着湖面,绝望地叹了口气。\n"); wait(); printf("你饿死了。\n"); wait(); goto gameover; } } else { if(b==1) { printf("你用锤子砸破了冰面,却没办法捞鱼。你无奈地望着湖面,绝望地叹了口气。\n"); wait(); printf("你饿死了。\n"); wait(); goto gameover; } else { printf("你很想捞鱼,却无法打破冰面,又没办法捞鱼。你无奈地望着湖面,绝望地叹了口气。\n"); wait(); printf("你饿死了。\n"); wait(); goto gameover; } } a20:cls(); printf("你找来许多木头,点燃了篝火。飞机上的人看见了浓烟,降落下来,把你救上了飞机。\n"); wait(); printf("事后,你被送去了医院治疗。\n"); printf("生存成功!\n"); wait(); goto gameover; a21:cls(); printf("你绕过了隧道,继续走。\n"); goto a9; a22:cls(); printf("你要继续走吗?\n1-是。\n2-不了。\n"); s22:wait(); switch(user_input) { case'1':goto a18; case'2':goto a9; default:goto s22; } a23:cls(); printf("你没有捡起绳子。"); wait(); wait(); goto a22; a24:cls(); printf("你找到了一把锤子。\n"); b++; wait(); wait(); goto a19; return 0; }

在C++中实现生命游戏 (Game of Life) ,并 遵循一些限制 ·生命游戏的规则 一个无限的二维正交方格单元格网格

在C++中实现生命游戏 (Game of Life) ,并 遵循一些限制。 ·生命游戏的规则 一个无限的二维正交方格单元格网格。 每个单元格处于两种可能的状态之一: 存活 或死亡。 每个单元格与其八个邻居进行交互:存活的 单元格如果周围少于两个存活的邻居,则死 存活的单元格如果周围有两个或三个存活的 邻居,则继续存活到下一代。 存活的单元格如果周围有超过三个存活的邻 居,则死亡。 死亡的单元格如果周围恰好有三个存活的邻 居,则在下一代变为存活状态 步骤 第一个版本 a.可以设置网格大小。 b.模拟运行,直到用户触发停止信号。 c.需要以下函数 i.run0: 执行一代。 ii.display0:显示当前状态。 iii.init0: 初始化网格 第二个版本 (如果您感觉自信,可以首先尝 a.定义Automaton类来模拟游戏。 b.可以暂停和恢复模拟。 第三个版本a.定义Cell类 i.每个单元格负责计算下一代的步骤。 ii.单元格显示其状态 第四个版本 a.可以将当前代保存和加载到文件中 b.单元格可以检测一些模式并通知用户 第五个版本 a.用户可以在运行时更改单元格的状态 b.可以撤

C++小游戏源码之-野外生存(仿生火间).cpp

C++小游戏源码,可供学习及设计参考。

「C++控制台生存游戏」暗黑体素 DarkVoxel 控制台版

现在设成免费!!!! 刚进高中前开始写的一款抽象的生存游戏 BUG很多请见谅 『暗黑体素 DarkVoxel』 一款由Wormwaker【开发的时候昵称又叫noexcept】开发的、二维小型生存控制台游戏。 玩家可以在里面自由生存、挖矿、打怪等 【提示:现在作者正在开发第二版,将会非常精彩,敬请期待】 ★ 基本玩法: * A,W,S,D移动 > 有冷却 * J 摧毁方块/使用工具/攻击 > 注意不能徒手攻击生物 * K 放置方块/开关门 * L 打开箱子 > 箱子不是方块,可以藏在方块后面 * 0~9 选择快捷栏物品 * E 打开背包 > 后面还有一些格子可以放东西 * 其余操作可以在主界面->选项->操作说明查看。 联系方式 QQ 2399347979

从零到一:基于Rocky Linux 9的Kubernetes高可用集群部署实战

本文提供了一份基于Rocky Linux 9操作系统,从零开始部署Kubernetes高可用集群的完整实战指南。详细讲解了包括系统初始化、容器运行时配置、使用kubeadm工具进行集群初始化、节点加入以及Calico网络插件安装在内的核心步骤,并针对国内网络环境提供了镜像加速等优化方案,旨在帮助读者构建一个稳定可靠的生产级K8s环境。

weixin_29197835的博客 134

TwinCAT3入门教程3——PLC程序变量定义和硬件IO关联

目录 1、IO输入输出变量定义和硬件关联 1.1 IO输入 1.2 IO输出 1.3 PLC变量和IO模块关联 1.4 测试IO输出点 2、伺服变量关联 1、IO输入输出变量定义和硬件关联 1.1 IO输入 添加全局变量IO_Global 变量定义 (*==========================================IO输入===============================================================*)

panjinliang066333的博客 1万+

从Google到LLVM:5种主流clang-format预设风格横向对比(含代码对比图)

本文横向对比了LLVM、Google、Chromium、Mozilla和WebKit五种主流的clang-format预设代码风格。通过同一段C++代码的格式化效果对比图,直观展示了它们在指针对齐、大括号换行、缩进等关键细节上的差异,并提供了基于团队背景与项目基因的选型决策指南。

weixin_28828243的博客 442

Zabbix 简介、优缺点、基础原理

(8条消息) Zabbix 的基础概念、原理和架构_Lee木木的博客-优快云博客_zabbix架构类型Zabbix 的基础概念、原理和架构_Lee木木的博客-优快云博客_zabbix架构类型 --------------------------------------------------------------------------------------------------------------------------- 一、Zabbix 简介 Zabbix是由A...

weixin_50196615的博客 2036

ZYNQ软件复位重启、程序跳转的实现方法(Multiboot)

目录一、增加FSBL的调试信息 一、增加FSBL的调试信息 启动过程的调试信息如下: Xilinx First Stage Boot Loader Release 2016.4 Jan 19 2020-10:35:00 Devcfg driver initialized Silicon Version 3.1 Boot mode is QSPI Single Flash Informat...

weixin_41922484的博客 2万+

《网络安全自学教程》- 802.1x协议

802.1x协议架构,工作原理/认证流程,认证方式,MAB认证,触发认证的三种方式,EAP报文格式,EAPOL报文格式

wangyuxiang946的博客 2万+

TI单芯片毫米波雷达1642demo代码走读(一)

今天我们来实际看下代码。 首先使用CCS软件导入demo工程,工程有两个,一个是ARM的工程,工程名是mmw_mss_16xx;另一个是DSP的工程,工程名为mmw_dss_16xx。我们将这两个工程的主函数打开,分别位于mss_main.c和dss_main.c文件中。 先看mss的主函数,代码如下。我为每行代码都加了中文注释和自己的理解。 int main (void) { Task_Params taskPara...

1万+

【RH850/U2A】:功能安全

功能安全相关

3130

RU DOS版、EFI版32bit/64bit BIOS常用工具

DOS版、EFI版的RU工具,可用来查看IO、MEM、PCI、SMBIOS等资源。亲测在EFI SHELL下可用。

VC中sqlite的使用

在VC中对sqlite的使用,实现数据库大批数据的快速插入,读取数据库中的数据在ListCtrl中显示

复分析 阿尔福斯(Ahlfors) 第三版答案 英文

答案分为十章,有部分习题没有答案,全英文复分析阿尔福斯(Ahlfors) 第三版答案

锂电池充电器电路设计 里面有电路

锂电池充电器电路设计 里面有电路 3.7V升压到5V电路设计。

上一篇: c++入门之——输入输出
下一篇: 逻辑门(1)
return_dr
博客等级 码龄5年 216粉丝 105原创
评论 13
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值