基本信息
源码名称:C++小游戏(控制台程序)
源码大小:0.07M
文件格式:.cpp
开发语言:C/C++
更新时间:2020-01-31
   友情提示:(无需注册或充值,赞助后即可获取资源下载链接)

     嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):813200300

本次赞助数额为: 3 元 
   源码介绍
C 小游戏

int zidongpipei() {
system("cls");
int boss_maxhealth,boss_health;
int boss_gongji;
srand(time(NULL));
int z = (ceil(wd_health * 1.2)) - (ceil(wd_health * 0.8)) 1;
int y = (ceil(wd_gongji * 1.2)) - (ceil(wd_gongji * 0.8)) 1;
boss_maxhealth = (rand() % z (ceil(wd_health * 0.8)))*0.7;
boss_health = boss_maxhealth;
boss_gongji = (rand() % y (ceil(wd_gongji * 0.8)))*0.6;
while (wd_health >= 0)
{
srand(time(NULL));
QP:
system("cls");
cout << "对手血量:" << boss_maxhealth << endl << "对手攻击:" << boss_gongji << endl;
if (wd_health <= 0) {
die();
}
double o = wd_gongji * ((rand() % 2) 1) double(rand() % 10 / 10);
boss_health -= o;
cout << "你对对手造成了" << o << "点伤害" << endl;
cout << "对手当前剩余血量:" << boss_health << endl << endl;
if (boss_health <= 0)
{
srand(time(NULL));
int x = ceil((boss_maxhealth boss_gongji) / (rand() % 2 1));
cout << "胜利!获得" << x << "点金币" << "       " << "剩余血量:" << wd_health << endl;
wd_money = x;
cout << "余额:" << wd_money;
getch();
zhujiemian();
}
cout << "1.逃跑        2.进攻        3.购买临时战斗用品";
char s = getch();

if (s < '1' || s>'3')
{
system("cls");
goto QP;
}
if (s == '1')
{
system("cls");
zhujiemian();
}
if (s == '2') {
double l = boss_gongji * ((rand() % 2) 1) fabs(double(rand() % 100 / 100 - 2));
if (s == '2') {
cout << "对手对你造成了" << l << "点伤害" << endl;
wd_health -= l;
cout << "你当前剩余血量:" << wd_health << endl;
if (wd_health <= 0) {
die();
}
double o = wd_gongji * ((rand() % 2) 1) double(rand() % 10 / 10);
boss_health -= o;
cout << "你对对手造成了" << o << "点伤害" << endl;
cout << "对手当前剩余血量:" << boss_health << endl << endl;
if (boss_health <= 0)
{
srand(time(NULL));
int x = ceil((boss_maxhealth boss_gongji) / (rand() % 2 1));
cout << "胜利!获得" << x << "点金币" << "       " << "剩余血量:" << wd_health << endl;
wd_money = x;
cout << "余额:" << wd_money;
getch();
zhujiemian();
}
}

}
if (s == '3') {
AD:
system("cls");
cout << "1.TNT $100 -5000    2.飞镖*2 $200 -11000      3.火箭筒 $500 K.O      4.Exit " << endl;
char w = getch();
if (w < '1' || w>'4') {
goto AD;
}
switch (w)
{
case '1':
if (wd_money >= 100) {
wd_money -= 100;
boss_health -= 5000;
goto AD;
}
else {
goto AD;
}
case'2':
if (wd_money >= 200) {
wd_money -= 200;
boss_health -= 11000;
goto AD;
}
else {
goto AD;
}
case '3':
if (wd_money >= 500) {
wd_money -= 500;
boss_health = 0;
goto AD;
}
else {
goto AD;
}
case '4':
goto QP;
}
}
}
return true;
}

int zixuanzhandou() {
ZXZD:
system("cls");
cout << "选择0~49级的敌人(打野,1~3个敌人.)";
int d = getchar();



if (d < 0 || d>49) {
system("cls");
goto ZXZD;
}
int bossM = _xiaoguaimaxhealth[d];
int bossH = _xiaoguaihealth[d];
int bossG = _xiaoguaigongji[d];
srand(time(NULL));
int h = rand() % 3 1;
bossG = bossG * h;


while (wd_health >= 0)
{
QP:
cout << "有" << h << "个小怪" << endl;
cout << "对手血量:" << bossH << endl << "对手攻击:" << bossG << endl;
if (bossH <= 0)
{
srand(time(NULL));
int x = (ceil(bossM bossG) / (rand() % 2 1));
cout << "胜利!获得" << x << "点金币" << "       " << "剩余血量:" << wd_health << endl;
wd_money = x;
cout << "余额:" << wd_money;
getch();
zhujiemian();
}
cout << "1.逃跑        2.进攻           3.购买临时战斗用品  ";
char s = getch();

if (s < '1' || s>'3')
{
system("cls");
goto QP;
}
if (s == '1')
{
system("cls");
zhujiemian();
}
if (s == '2') {

double l = bossG * ((rand() % 2) 1) fabs(double(rand() % 100 / 100 - 2));
cout << "对手对你造成了" << l << "点伤害" << endl;
wd_health -= l;
cout << "你当前剩余血量:" << wd_health << endl;
if (wd_health <= 0) {
die();
}
double o = wd_gongji * ((rand() % 2) 1) double(rand() % 10 / 10);
bossH -= o;
cout << "你对对手造成了" << o << "点伤害" << endl;
cout << "对手当前剩余血量:" << bossH << endl << endl;
if (bossH <= 0)
{
srand(time(NULL));
int x = (ceil(bossM bossG) / (rand() % 2 1));
cout << "胜利!获得" << x << "点金币" << "       " << "剩余血量:" << wd_health << endl;
wd_money = x;
cout << "余额:" << wd_money;
getch();
zhujiemian();
}
}
if (s == '3') {
ADd:
system("cls");
cout << "1.TNT $100 -5000    2.飞镖*2 $200 -11000      3.火箭筒 $500 K.O      4.Exit " << endl;
char w = getch();
if (w < '1' || w>'4') {
goto ADd;
}
switch (w)
{
case '1':
if (wd_money >= 100) {
wd_money -= 100;
bossH -= 5000;
goto ADd;
}
else {
goto ADd;
}
case'2':
if (wd_money >= 200) {
wd_money -= 200;
bossH -= 11000;
goto ADd;
}
else {
goto ADd;
}
case '3':
if (wd_money >= 500) {
wd_money -= 500;
bossH = 0;
goto ADd;
}
else {
goto ADd;
}
case '4':
goto QP;
}
}
}
return true;
}