Discuz! Board

 找回密码
 立即注册
查看: 355|回复: 0

口袋妖精

[复制链接]

54

主题

66

帖子

574

积分

高级会员

Rank: 4

积分
574
发表于 2022-11-26 11:06:48 | 显示全部楼层 |阅读模式
(请薛老师多多指导~)
[C++] 纯文本查看 复制代码
#include <bits/stdc++.h>
#include <windows.h>
using namespace std;
int yuan=20,t=0;
char chw[5][51]={"1.宠物蛋    0元     布吉岛会孵出什么pokemon",
                                "2.小火龙    5000元  尾部的火焰灭了就代表它已经KO了",
                                "3.妙蛙种子  5000元  背上有个green大蒜",
                                "4.杰尼龟    5000元  蓝色妖姬龟",
                                "5.退出"};
string bag[100]={" "};
char shop[10][51]={"1.精灵球 20元/颗                2.高级球 100元/颗",
                                   "3.触网球 120元/颗                4.深水球 120元/颗"};
int main()
{ 
        int i=0;
        here:
                system("cls");
                cout<<"1.精灵商店  2.商店  3.打开CD  4.冒险  5.背包"<<endl;
                cin>>i;
                switch(i)
                {
                        case(1):
                                system("cls");
                                goto here1;
                        case(2):
                                system("cls");
                                goto here2;
                        default:
                                system("cls");
                                goto here; 
                }
                here1:
                        cout<<"您有"<<yuan<<"元"<<endl;
                        for(int i=0;i<5;i++){
                                for(int j=0;j<51;j++){
                                        cout<<chw[i][j];
                                }
                                cout<<endl;
                        }
                        cin>>i;
                        switch(i)
                        {
                                case(1):
                                        bag[t]="宠物蛋";
                                        t++;
                                        goto here;
                                case(2):
                                        if(yuan<5000) 
                                        {
                                                system("cls");
                                                cout<<"金币不够!";
                                                Sleep(1000);
                                                goto here;
                                        }
                                        yuan=yuan-5000;
                                        bag[t]="小火龙";
                                        t++;
                                        goto here;
                                case(3):
                                        if(yuan<5000) 
                                        {
                                                system("cls");
                                                cout<<"金币不够!";
                                                Sleep(1000);
                                                goto here;
                                        }
                                        yuan=yuan-5000;
                                        bag[t]="妙蛙种子";
                                        t++;
                                        goto here;
                                case(4):
                                        if(yuan<5000) 
                                        {
                                                system("cls");
                                                cout<<"金币不够!";
                                                Sleep(1000);
                                                goto here;
                                        }
                                        yuan=yuan-5000;
                                        bag[t]="杰尼龟";
                                        t++;
                                        goto here;
                                case(5):
                                        goto here; 
                        }
                here2:
                        cout<<"您有"<<yuan<<"元"<<endl;
                        for(int i=0;i<5;i++)
                        {
                                for(int j=0;j<51;j++)
                                {
                                        cout<<shop[i][j];
                                }
                                cout<<endl;
                        }
                        cin>>i;
                        switch(i)
                        {
                                case(1):
                                        if(yuan<20) 
                                        {
                                                system("cls");
                                                cout<<"金币不够!";
                                                Sleep(1000);
                                                goto here;
                                        }
                                        yuan=yuan-20;
                                        bag[t]="精灵球";
                                        t++;
                                        goto here;
                                case(2):
                                        if(yuan<100) 
                                        {
                                                system("cls");
                                                cout<<"金币不够!";
                                                Sleep(1000);
                                                goto here;
                                        }
                                        yuan=yuan-100;
                                        bag[t]="高级球";
                                        t++;
                                        goto here;
                                case(3):
                                        if(yuan<120) 
                                        {
                                                system("cls");
                                                cout<<"金币不够!";
                                                Sleep(1000);
                                                goto here;
                                        }
                                        yuan=yuan-120;
                                        bag[t]="触网球";
                                        t++;
                                        goto here;
                                case(4):
                                        if(yuan<120) 
                                        {
                                                system("cls");
                                                cout<<"金币不够!";
                                                Sleep(1000);
                                                goto here;
                                        }
                                        yuan=yuan-120;
                                        bag[t]="深水球";
                                        t++;
                                        goto here;
                        }
}
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|DiscuzX

GMT+8, 2025-7-18 08:30 , Processed in 0.061828 second(s), 26 queries .

Powered by Discuz! X3.4

© 2001-2013 Comsenz Inc.. 技术支持 by 巅峰设计

快速回复 返回顶部 返回列表