第一次发表文章,随便写个文字游戏的程序,没想到还没写到一半,只定个框架程序就崩了,还得继续努力(●°u°●) 」。
#include
using namespace std;
struct partner
{
int aggressivity=50;
int defence=250;
int blue=300;
int red=2000;
string jineng = “坚壁守护(可以为队友加上一层500值的护盾,并且减免5%的物理和法术伤害)”;
};
struct player
{
string id;
int aggressivity = 10;
int defense = 50;
int blue = 150;
int red = 200;
string birthplace = “新手村”;
string prop = “小蘑菇(回复队友20%的血量并加上一层200值的护盾)”;
string technique = “神光守护(复活一名队友并且带有30%的血量和50%的蓝条)”;
};
class game
{
public:
static int yincang1;
static int yincang2;
static int renwu1;
static int renwu2;
static int money ;
static player player;
static char yidong;
static int bushu;
static bool zhandou;
static void taopao();
void begain();
void ditu();
static void movement();
void yuguai();
static void yincang();
void shengji();
void gouwu();
void zhandou1();
void renwu();
private:
int shanghaizhi;
string gongjijiemian;
string jingruxiayilun;
int daguai1;
int daguai2;
partner patner1;
}; int money = 150; int yincang1 = 50; int yincang2 = 1000; int renwu1 = 100; int renwu2 = 2000;
void game::begain()
{
string id;
cout << “恭喜亲爱的傻逼宿主,宁已经穿越到游戏世界--。" << endl;
cout << “请坐好,游戏马上就要开始了哦_。” << endl;
cout << “5,4,3,2,1” << endl;
cout << "欢迎进入游戏世界,傻逼宿主--。” << endl;
cout << “请输入您的id” << endl;
cin >> id;
cout << “您的id是” << id << endl;
cin >> id;
cout << “正在创建角色中…” << endl;
cout << “宿主是傻逼,宿主是傻逼,宿主是傻逼…” << endl;
cout << “角色创建成功” << endl;
cout << “请开始愉快的冒险吧!” << endl;
game::movement();
}
void game::ditu()
{
cout << “******** o " << endl;
cout << "! ***** !! !" << endl;
cout << "x xx x x" << endl;
cout << "
∗
∗
**
∗∗ xxxx&" << endl;
cout << "x *** ** ** " << endl;
cout << "$$***#*” << endl;
}
void game::movement()
{
if (game::yidong == ‘w’)
{
cout << “15级后开设野外地图--,当前实力将会被虐爆,是否仍要前进--。” << endl;
if (game::zhandou )
{
game::player.red = 0;
cout << “重新开始游戏-_-。” << endl;
}
else
{
cout << “请移动” << endl;
game::movement();
}
}
if (yidong == 'a')
{
cout << "您向左移动了" << bushu << "步。" << endl;
cin >> yidong >> bushu;
game::movement();
}
else if (yidong == 'd')
{
cout << "您向右移动了" << bushu << "步。" << endl;
cin >> yidong >> bushu;
game::movement();
}
else if (yidong == 's')
{
cout << "您向下移动了" << bushu << "步。" << endl;
cin >> yidong >> bushu;
game::movement();
}
else if (yidong == 'w')
{
cout << "您向上移动了" << bushu << "步。" << endl;
cin >> yidong >> bushu;
game::movement();
}
}
void game::taopao()
{
cout << “你的金币减少了10,用来贿赂小怪” << endl;
money = money - 10;
}
void game::yuguai()
{
cout << “您遇到了一只小怪,是否打劫其财物。。” << endl;
if (game::zhandou)
{
cout << “进入打斗的界面” << endl;
}
else
{
cout << “您作为一个弱者,竟然逃跑了-_-” << endl;
game::taopao();
}
}
void game::zhandou1()
{
cout << “你正在与小怪进行战斗中,加油哦…” << endl;
cout << “获得金币:” << daguai1 << “获得经验:” << daguai2 << endl;
}
void game::renwu()
{
cout << “你接到了一个任务” <<“进入游戏14天,并行走10000步!” << “任务赏金为:” << game::renwu1 << “获得经验为:” << game::renwu2 << endl;
}
void game::yincang()
{
cout << "宁遇到了隐藏的宝箱,恭喜你个憨憨·_·" << endl;
cout << "获得金币:" <<game::yincang1<< "获得经验:" <<game::yincang2<< "获得一个神迹兵器" << endl;
cout << "嗜血之刃" << "攻击力:" << 500 << "属性:" << "可以将伤害的35%转换为治疗量" <<endl;
cout << "恭喜您获得神器,牛逼" << endl;
}
void shengji()
{
}
int main()
{
//小游戏制作案例
cout << "hello world" << endl;
}
发出了警告,这是啥意思,如果有大佬看到了帮忙解释一下。谢谢(*°∀°)=3
[Warning] non-static data member initializers only available with -std=c++11 or -std=gnu++11[Warning] non-static data member initializers only available with -std=c++11 or -std=gnu++11[Warning] non-static data member initializers only available with -std=c++11 or -std=gnu++ 11[Warning] non-static data member initializers only available with -std=c++11 or -std= gnu++11[Warning] non-static data member initializers only available with -std=c++11 or -std=gnu++11[Warning] non-static data member initializers only available with -std=c++11 or -std=gnu++11[Warninq1 non-static data member initializers onlv available with -std=c++11 or -std=qnu++11