(请薛老师多多指导~) [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;
}
} |