admin管理员组文章数量:1130349
天天打个怪
// 古文波原创 //
#include <bits/stdc++.h>
#include <windows.h>
#include <conio.h>
using namespace std;
int now_zombies = 0;
int now_WuQi = 0;
bool fuli;
struct Me {
int HP;
int Attack;
int Lvl;
int Exp;
int EXP_MAX;
int QH;
} My;
struct zombie {
int HP;
int Attack;
string Name;
int hard;
} a[10007];
struct WU {
string name;
int add_Att;
int add_HP;
int kind;
bool have;
} w[10007];
struct Ku {
int wuqi_id;
int fangjv_id;
int zuoqi_id;
} WuQi_Ku;
struct SheZhi {
bool Fast;
bool Buff;
bool All;
} SZ;
void cls() {
system("cls");
}
void new_(int hp, int att, string name, int Hard) {
int t = ++now_zombies;
a[t].HP = hp;
a[t].Attack = att;
a[t].Name = name;
a[t].hard = Hard;
}
void _new(string n, int add_1, int add_2, int kinds) {
int t = ++now_WuQi;
w[t].name = n;
w[t].add_Att = add_1;
w[t].add_HP = add_2;
w[t].kind = kinds;
w[t].have = false;
}
int Me_Attack(int x) {
int r = rand() % 100 + 1;
int attack = 1;
if(r <= 20) {
attack = My.Attack * 2;
printf("你:暴击!对敌方造成%d点高额伤害", attack);
return attack;
}
if(r >= 21 && r <= 25) {
attack = My.Attack * 5;
printf("你:大招!对敌方造成%d点爆炸伤害", attack);
return attack;
}
if(r >= 26 && r <= 95) {
attack = My.Attack;
printf("你:对敌方造成%d点伤害", attack);
return attack;
}
if(r >= 96 && r <= 100) {
attack = x / 2;
printf("你:使用毒素攻击!敌方血量减半");
return attack;
}
}
int Di_Attack(int x, int att) {
int r = rand() % 100 + 1;
int attack = 1;
if(r <= 20) {
attack = att * 2;
printf("敌:暴击!对你造成%d点高额伤害", attack);
return attack;
}
if(r >= 21 && r <= 25) {
attack = att * 5;
printf("敌:大招!对你造成%d点爆炸伤害", attack);
return attack;
}
if(r >= 26 && r <= 95) {
attack = att;
printf("敌:对你造成%d点伤害", attack);
return attack;
}
if(r >= 96 && r <= 100) {
attack = x / 2;
printf("敌:使用毒素攻击!你的血量减半");
return attack;
}
}
int Zombie_Attack(int att) {
int r = rand() % 100 + 1;
printf("怪物对你造成%d点伤害", att);
if(r <= 20) {
printf("\n攻击被格挡,伤害减半");
att /= 2;
}
if(r >= 21 && r <= 25) {
printf("\n攻击被闪避");
att = 0;
}
return att;
}
void ccc(string s) {
for(int i = 0; i < s.size(); i++) {
cout << s[i];
Sleep(20);
}
cout << "\n";
}
void slow(string s) {
int f;
if(SZ.Fast) f = 1;
else f = 2;
for(int i = 0; i < s.size(); i++) {
cout << s[i];
Sleep(150 * f);
}
cout << "\n";
}
void Game() {
srand((unsigned)time(NULL));
cls();
ccc("欢迎英雄回家!");
Sleep(1000);
cls();
ccc("请选择你想要操作:");
ccc("1.关卡 2.查看我的信息 3.强化 4.双人对战 5.装备区 6.更新日志 7.新手福利 8.自定义设置");
string s;
cin >> s;
if(s == "1") {
cls();
int t = 0, r = 0;
for(int i = 1; i <= 3; i++) {
cout << "已加载" << i * 30 << "%~\n";
t = r;
r = rand() % 6 + 1;
if(r == t) r = rand() % 6 + 1;
if(r == 1) printf("主线关卡和双人对战获胜均可获得经验值~\n");
if(r == 2) printf("强化可以增加20%的属性~\n");
if(r == 3) printf("毒素非常厉害,可以让怪物血量砍半~\n");
if(r == 4) printf("可以在主页看到自己的等级~\n");
if(r == 5) printf("Boss关卡难度很高,可以重复打之前的关卡升级再打~\n");
if(r == 6) printf("对方的攻击是可能被格挡或闪避的哦~\n");
slow("->->->");
cls();
}
ccc("选择关卡");
for(int i = 1; i <= now_zombies; i++) {
printf("%d. ", i);
cout << a[i].Name;
cout << "\t";
if(i < 6 || i > 9) cout << "\t";
cout << "难度:";
for(int j = 1; j <= a[i].hard; j++) cout << "☆";
cout << "\n";
}
int x;
cin >> x;
if(x < 1 || x > now_zombies) {
cls();
system("color 04");
slow("Error!");
Sleep(1000);
system("color 09");
Game();
}
else {
cls();
slow("战斗准备中~~~");
cout << "\n";
int zombie_HP = a[x].HP;
int zombie_Attack = a[x].Attack;
int My_HP = My.HP;
int My_Attack = My.Attack;
while(1) {
zombie_HP -= Me_Attack(zombie_HP);
printf("\n怪物还剩%d点血\n\n", zombie_HP);
Sleep(1000);
if(zombie_HP <= 0) {
cls();
slow("获得胜利!");
Sleep(1000);
My.Exp += 100 << x + 1;
My.QH += 5 << x - 1;
if(My.Exp >= My.EXP_MAX) {
cls();
slow("升级了");
while(1) {
if(My.Exp >= My.EXP_MAX) {
My.Exp -= My.EXP_MAX;
My.EXP_MAX <<= 1;
My.Lvl++;
My.Attack *= 1.5;
My.HP *= 1.5;
}
else break;
}
printf("你现在%d级", My.Lvl);
Sleep(1000);
}
break;
}
My_HP -= Zombie_Attack(zombie_Attack);
printf("\n你还剩%d点血\n\n", My_HP);
Sleep(1000);
if(My_HP <= 0) {
cls();
slow("You Die!");
My.Exp -= 100 << x - 1;
break;
}
}
Game();
}
}
if(s == "2") {
cls();
ccc("基本信息如下");
printf("\n等级:%d\n经验值:%d\n经验值上限:%d\n攻击力:%d\n生命值:%d\n\n", My.Lvl, My.Exp, My.EXP_MAX, My.Attack, My.HP);
ccc("请按任意键继续~~~");
char c = getch();
Game();
}
if(s == "3") {
cls();
printf("你有%d个强化点,强化需要10强化点\n", My.QH);
Sleep(1000);
if(My.QH < 10) {
ccc("强化点不足,无法进行强化");
Game();
}
ccc("输入:1. 强化攻击 2. 强化生命");
char c = getch();
if(c == '1') My.Attack = My.Attack * 6 / 5;
else My.HP = My.HP * 6 / 5;
My.QH -= 10;
cls();
slow("强化成功!");
Game();
}
if(s == "4") {
cls();
for(int i = 1; i <= 3; i++) {
cout << "正在联网寻找对手";
slow("->->->");
cls();
}
int r = rand() % 10 + 1;
cout << "你 VS ";
if(r == 1) cout << "烟柳一枝花";
if(r == 2) cout << "英雄小五";
if(r == 3) cout << "笑的很甜蜜";
if(r == 4) cout << "北风吹";
if(r == 5) cout << "别打了";
if(r == 6) cout << "你干嘛~";
if(r == 7) cout << "牢大坠机啦!";
if(r == 8) cout << "秋风萧瑟";
if(r == 9) cout << "为神马0505";
if(r == 10) cout << "江洋大盗重彪脸";
Sleep(1000);
cls();
int My_HP = My.HP;
int Di_Att = (rand() % (My.Lvl * 15) + 10) / 5 * 5;
int Di_HP = My.Lvl * 100 - Di_Att;
while(1) {
Di_HP -= Me_Attack(Di_HP);
printf("\n敌方还剩%d点血\n\n", Di_HP);
Sleep(1000);
if(Di_HP <= 0) {
cls();
slow("Win!!!");
My.Exp += 100 << My.Lvl + 1;
My.QH += 5 << My.Lvl - 1;
if(My.Exp >= My.EXP_MAX) {
cls();
slow("升级了");
while(1) {
if(My.Exp >= My.EXP_MAX) {
My.Exp -= My.EXP_MAX;
My.EXP_MAX <<= 1;
My.Lvl++;
My.Attack *= 1.5;
My.HP *= 1.5;
}
else break;
}
printf("你现在%d级", My.Lvl);
Sleep(1000);
}
Game();
}
My_HP -= Di_Attack(My_HP, Di_Att);
printf("\n你还剩%d点血\n\n", My_HP);
Sleep(1000);
if(My_HP <= 0) {
cls();
slow("Lose!!!");
Game();
}
}
}
if(s == "5") {
cls();
ccc("您有如下装备");
cout << "\n";
bool f = false;
for(int i = 1; i <= now_WuQi; i++) {
if(w[i].have) {
cout << w[i].name << "\t攻击:" << w[i].add_Att << " 生命:" << w[i].add_HP << "\n";
f = true;
}
}
if(!f) {
Sleep(1000);
ccc("啊嘞?空空如也");
}
cout << "\n";
ccc("已装备:");
int t1 = WuQi_Ku.wuqi_id, t2 = WuQi_Ku.fangjv_id, t3 = WuQi_Ku.zuoqi_id;
cout << "武器:" << w[t1].name << "\n";
cout << "防具:" << w[t2].name << "\n";
cout << "坐骑:" << w[t3].name << "\n";
ccc("你要装上装备吗?(Y/N)");
char c = getch();
if(c == 'Y') {
cls();
ccc("装上哪个编号的?");
for(int i = 1; i <= now_WuQi; i++) {
cout << i << ". " << w[i].name << setw(20) << "拥有状态:";
if(w[i].have) cout << "Yes";
else cout << "No";
cout << "\n";
}
int x;
cin >> x;
if(!w[x].have) {
cls();
ccc("你未拥有");
Sleep(1000);
Game();
}
if(w[x].kind == 1) {
WuQi_Ku.wuqi_id = x;
My.Attack += w[x].add_Att;
My.HP += w[x].add_HP;
}
if(w[x].kind == 2) {
WuQi_Ku.fangjv_id = x;
My.Attack += w[x].add_Att;
My.HP += w[x].add_HP;
}
if(w[x].kind == 3) {
WuQi_Ku.zuoqi_id = x;
My.Attack += w[x].add_Att;
My.HP += w[x].add_HP;
}
Game();
}
else Game();
}
if(s == "6") {
cls();
ccc("v1.0.0 最基本的游戏");
ccc("v1.0.3 加载画面修改");
ccc("v1.1.2 新增强化功能");
ccc("v1.1.5 修复已知问题,初始化界面修改");
ccc("v1.1.9 增加关卡到10个");
ccc("v1.3.1 增加双人对战模式");
ccc("v1.4.9 增加武器库功能");
ccc("v1.5.1 新增新人福利活动");
ccc("v1.6.3 新增自定义设置");
ccc("请按任意键继续~~~");
char c = getch();
Game();
}
if(s == "7") {
cls();
if(fuli) {
slow("已领取~");
Sleep(1000);
Game();
}
ccc("推出新人福利活动!十件超强装备随机派送!");
ccc("请按任意键领取");
char c = getch();
cls();
slow("恭喜获得");
int r = rand() % now_WuQi + 1;
cout << w[r].name << "!";
ccc("奖励已经发放到武器库~");
w[r].have = true;
fuli = true;
Sleep(3000);
Game();
}
if(s == "8") {
cls();
ccc("可设置:1.快速加载 2.外挂模式(关闭将初始化) 3.满装备模式");
string x;
cin >> x;
if(x == "1") {
if(SZ.Fast) {
ccc("已关闭快速加载");
SZ.Fast = false;
}
else {
ccc("已开启快速加载");
SZ.Fast = true;
}
Sleep(1000);
}
if(x == "2") {
if(SZ.Buff) {
ccc("已关闭外挂模式");
SZ.Buff = false;
My.Attack = 10;
My.HP = 100;
}
else {
ccc("已开启外挂模式");
SZ.Buff = true;
My.Attack = 114514;
My.HP = 114514;
}
Sleep(1000);
}
if(x == "3") {
if(SZ.All) {
ccc("已关闭满装备模式");
SZ.All = false;
for(int i = 1; i <= now_WuQi; i++) w[i].have = false;
}
else {
ccc("已开启满装备模式");
SZ.All = true;
for(int i = 1; i <= now_WuQi; i++) w[i].have = true;
}
Sleep(1000);
}
Game();
}
}
void My_inti() {
My.Attack = 10;
My.HP = 100;
My.Lvl = 1;
My.Exp = 0;
My.EXP_MAX = 1000;
My.QH = 0;
}
void zombies_inti() {
new_(100, 10, "Cai XuKun", 1);
new_(250, 25, "Lao Da", 2);
new_(500, 30, "Ri Ben", 3);
new_(600, 50, "Lao Liu", 3);
new_(1000, 88, "Little Boss", 4);
new_(1200, 100, "Chinese Teacher", 5);
new_(500, 300, "Maths Teacher", 5);
new_(2000, 50, "English Teacher", 5);
new_(1500, 150, "I Have No NAME", 5);
new_(3000, 300, "BIG BOSS!!!", 7);
}
void WuQi_inti() {
w[0].name = "Null";
_new("AK-47", 35, 0, 1);
_new("Ba Zu KA", 100, -75, 1);
_new("Qing Hong Sword", 30, 0, 1);
_new("Green Dragon Crescent Blade", 50, -20, 1);
_new("AUG", 35, 0, 1);
_new("Gold Beetle", 20, 100, 2);
_new("Rattan Beetle", 0, 150, 2);
_new("Di Du Horse", -10, 150, 3);
_new("Chi Tu Horse", 10, 100, 3);
_new("Plane", 500, 10000, 3);
WuQi_Ku.wuqi_id = WuQi_Ku.fangjv_id = WuQi_Ku.zuoqi_id = 0;
}
void inti() {
zombies_inti();
My_inti();
WuQi_inti();
system("color 09");
slow("By GuWenBo");
Sleep(1000);
cls();
for(int i = 1; i <= 2; i++) {
cls();
cout << "Loading~~~\n";
slow("->->->");
}
Sleep(300);
Game();
}
int main() { inti();}
开局一个卒,士兵全靠买!
// By School //
#include <bits/stdc++.h>
#include <windows.h>
#include <conio.h>
using namespace std;
void ccc(); // 匀速输出
void c_slow(); // 缓慢输出
void cls(); // 清屏
void Error(); // 输出"Input Error"
void zhuye(); // 主界面
void inti(); // 初始化
long long money;
long long bing_1,bing_2 = 1,bing_3;
long long my_shili;
void ccc(string s) { // 匀速输出
for(int i = 0; i < s.size(); i++) {
cout << s[i];
Sleep(25);
}
printf("\n");
}
void c_slow(string s) { // 缓慢输出
for(int i = 0; i < s.size(); i++) {
cout << s[i];
Sleep(444);
}
printf("\n");
}
void cls() { // 清屏
system("cls");
}
void Error() { // 输出"Input Error"
cls();
c_slow("Input Error!");
zhuye();
}
void zhuye() { // 主界面
cls();
ccc("1.说明 2.商店 3.征战 4.我的资料 5.礼包码");
char s = getch();
if(s == '1') {
cls();
ccc("版本号: v.1.06 ");
ccc("征战获得钱");
ccc("钱买士兵");
ccc("按任意键继续");
char a = getch();
zhuye();
} else if(s == '2') {
cls();
ccc("1.普通士兵 10 元 一个 2. 中级士兵 66 元一个 3.高级士兵 111元一个 4.返回");
char a = getch();
if(a == '4') zhuye();
if(a == '1') {
ccc("输入个数");
printf("你有%lld元",money);
int num;
cin >> num;
if(money >= num * 10) {
money -= num * 10;
bing_1 += num;
ccc("购买成功!");
zhuye();
} else Error();
}
if(a == '3') {
ccc("输入个数");
printf("你有%lld元",money);
int num;
cin >> num;
if(money >= num * 111) {
money -= num * 111;
bing_3 += num;
ccc("购买成功!");
zhuye();
} else Error();
}
if(a == '2') {
ccc("输入个数");
printf("你有%lld元",money);
int num;
cin >> num;
if(money >= num * 66) {
money -= num * 66;
bing_2 += num;
ccc("购买成功!");
zhuye();
} else Error();
}
} else if(s == '3') {
cls();
my_shili = bing_1 * 3 + bing_2 * 10 + bing_3 * 30;
printf("我方战力:%lld\n",my_shili);
ccc("输入敌人等级(1 ~ 50)");
int num; cin >> num;
if(num < 1 || num > 50) Error();
long long di_shili = pow(2,num);
while(1){
if(di_shili <= 0) {
cls();
ccc("You Win!");
money += pow(3,num);
printf("你获得了");
cout << pow(3,num);
printf("元!\n");
Sleep(1000);
zhuye();
} if(my_shili <= 0) {
cls();
ccc("你全军覆没了!");
Sleep(1000);
ccc("你在混乱中被杀");
cls();
c_slow("You Are Die!");
Sleep(500);
inti();
}
printf("敌方战力:%lld\n",di_shili);
printf("我方战力:%lld\n",my_shili);
ccc("1.攻击 2.逃跑");
char a = getch();
if(a == '2') zhuye();
if(a == '1') {
if(my_shili >= di_shili) {
bing_1 = ceil(bing_1 * 1.0 / 1.5);
bing_2 = ceil(bing_2 * 1.0 / 1.25);
bing_3 = ceil(bing_3 * 1.0 / 1.125);
my_shili = bing_1 * 3 + bing_2 * 10 + bing_3 * 30;
di_shili /= 3;
} else {
bing_1 /= 2.5;
bing_2 /= 2;
bing_3 /= 1.5;
my_shili = bing_1 * 3 + bing_2 * 10 + bing_3 *30;
di_shili /= 1.5;
}
}
}
} else if(s == '4') {
cls();
printf("金币:%lld\n", money);
printf("普通士兵:%lld\n", bing_1);
printf("中级士兵:%lld\n", bing_2);
printf("高级士兵:%lld\n", bing_3);
printf("战力值:%lld\n", bing_1 * 3 + bing_2 * 10 + bing_3 * 30);
ccc("按任意键继续");
char a = getch(); zhuye();
} else if(s == '5') {
cls();
ccc("输入兑换码");
string a; getline(cin,a);
if(a == "HAPPY666") {
cls();
ccc("恭喜获得:200元");
money += 200;
Sleep(500);
zhuye();
} if(a == "School666") {
cls();
ccc("恭喜获得:20名中级士兵");
bing_2 += 20;
Sleep(500);
zhuye();
} if(a == "C++666") {
cls();
ccc("恭喜获得:6名高级士兵");
bing_3 += 6;
Sleep(500);
zhuye();
} if(a == "DevC++666") {
cls();
ccc("恭喜获得:66名低级士兵");
bing_1 += 66;
Sleep(500);
zhuye();
} else Error();
} else Error();
}
void inti() { // 初始化
cls();
system("color 09");
c_slow("By School");
Sleep(500);
cls();
c_slow("Loading……");
Sleep(500);
zhuye();
}
int main() { inti(); } // main()函数好像没用……
最强指挥官
// By School //
#include <bits/stdc++.h>
#include <windows.h>
#include <conio.h>
using namespace std;
void ccc(string s);
void c_slow(string s);
void cls();
void Error();
void zhuye();
void inti();
long long lvl = 1;
long long sum;
long long money = 50;
long long wuqi = 5;
long long MAX_SUM = 10;
void ccc(string s) {
for(int i = 0; i < s.size(); i++) {
cout << s[i];
Sleep(25);
}
cout << "\n";
}
void c_slow(string s) {
for(int i = 0; i < s.size(); i++) {
cout << s[i];
Sleep(444);
}
cout << "\n";
}
void cls() {
system("cls");
}
void Error() {
cls();
c_slow("Input Error!");
Sleep(500);
zhuye();
}
void zhuye() {
cls();
ccc("1.教程 2.征战 3.升级 4.招募 5.我的信息");
char a = getch();
if(a == '1') {
cls();
ccc("每次征战会获得财宝和武器");
ccc("财宝和武器到达一定数量可以升级军队等级");
ccc("军队等级的升级会大幅增加士兵上限和士兵战斗力");
ccc("加油吧,指挥官!");
ccc("请按任意键继续");
char n = getch();
zhuye();
}
else if(a == '2') {
cls();
ccc("输入等级 (<=50) 输入0返回");
int n;
cin >> n;
if(n == 0) zhuye();
cls();
printf("敌方士兵数:");
cout << pow(3,n) << "\n";
printf("我方士兵数:%d\n",sum);
printf("敌方等级:%d\n",n);
printf("我方等级:%d\n",lvl);
ccc("指挥官,是否发动进攻? 输入'Y'或'N' Y代表攻击 N代表逃跑");
char num = getch();
if(num == 'Y') {
if((pow(3,n) * pow(2,lvl) < sum * pow(2,lvl))) {
cls();
c_slow("You Win!");
ccc("恭喜收获:");
printf("\t"); cout << pow(5,n + 1) << "元\n";
printf("\t"); cout << pow(10,n - 1) << "把武器\n";
printf("\t"); cout << floor(pow(3,n) / 5) << "名俘虏\n";
ccc("请按任意键继续");
char s = getch();
money += pow(5,n + 1);
wuqi += pow(10,n - 1);
sum += pow(3,n) / 5;
zhuye();
} else { ccc("You Lose!"); zhuye(); }
}
else if(num == 'N') {
cls();
ccc("你损失了一些军费!");
printf("损失了:"); cout << pow(10,n) << "元"; money -= pow(10,n);
Sleep(1000);
zhuye();
}
else Error();
}
else if(a == '3') {
cls();
printf("你的当前等级是%d,升级需要",lvl);
cout << pow(20,lvl + 1);
printf("元和");
cout << pow(3,lvl + 1);
printf("把武器\n");
ccc("是否购买? Please Input 'Y' or 'N'");
char n = getch();
if(n == 'Y') {
if(money < pow(20,lvl + 1)) {
cls();
ccc("You Don't Have Enough Money!");
zhuye();
} else if(wuqi < pow(3,lvl + 1)) {
cls();
ccc("You Don't Have Enough Weapon!");
zhuye();
} else {
money -= pow(20,lvl + 1);
wuqi -= pow(10,lvl);
lvl++;
MAX_SUM *= 5;
ccc("OK!");
Sleep(500);
zhuye();
}
}
else if(n == 'N') zhuye();
else Error();
}
else if(a == '4') {
cls();
printf("招募一个士兵需要");
cout << pow(10,lvl);
printf("元,一把武器\n");
ccc("你要多少? 输入数字 输入-1可以购买最大上限个士兵");
int n;
cin >> n;
if(n == -1) {
int n1 = (money / (pow(10,lvl))), n2 = wuqi;
int num = min(n1,n2); int k = MAX_SUM - sum; if(num > k) num = k;
money -= num * pow(10,lvl);
wuqi -= num;
sum += num;
cls();
ccc("OK!");
printf("购买了%d个士兵",num);
Sleep(500);
zhuye();
}
else if(money < pow(10,lvl) * n) {
cls();
ccc("You Don't Have Enough Money!");
zhuye();
}
else if(wuqi < n) {
cls();
ccc("You Don't Have Enough Weapon!");
zhuye();
}
else if(sum + n > MAX_SUM) {
cls();
ccc("It Is So Big! Please add your level");
zhuye();
}
else {
sum += n;
money -= pow(10,lvl) * n;
cls();
ccc("OK!");
Sleep(500);
zhuye();
}
}
else if(a == '5') {
cls();
printf("等级:%d\n",lvl);
printf("士兵数量:%d\n",sum);
printf("士兵上限:%d\n",MAX_SUM);
printf("钱:%d\n",money);
printf("武器数量:%d\n",wuqi);
ccc("请按任意键继续");
char n = getch();
zhuye();
}
else Error();
}
void inti() {
system("color 09");
c_slow("By School");
cls();
c_slow("Loading……");
cls();
zhuye();
}
int main() { inti(); }
猜数游戏
// By School //
#include <bits/stdc++.h>
#include <windows.h>
using namespace std;
void cls() {
system("cls");
}
int power(int n) {
long long s = 1,i = 0;
while(s < n) {
s *= 2;
i++;
}
return i;
}
void ccc(string s) {
for(int i = 0; i < s.size(); i++) {
cout << s[i];
Sleep(25);
}
cout << "\n";
}
void c_slow(string s) {
for(int i = 0; i < s.size(); i++) {
cout << s[i];
Sleep(444);
}
cout << "\n";
}
int main() {
cls();
ccc("输入范围 输入0关闭");
int n;
cin >> n;
if(n == 0)
return 0;
cls();
srand((unsigned)time(NULL));
printf("范围为 1 ~ %d\n",n);
long long s = power(n);
long long ans = rand() % n + 1;
printf("你最少要猜%d次,更少算我输!\n",s);
ccc("猜吧");
long long sum = 1;
while(1) {
int x;
cin >> x;
if(x > ans) {
ccc("大了");
sum++;
}
else if(x < ans) {
ccc("小了");
sum++;
}
else {
cls();
c_slow("Yes!");
printf("你用了%d次!",sum);
break;
}
}
return 0;
}
天天打个怪
// 古文波原创 //
#include <bits/stdc++.h>
#include <windows.h>
#include <conio.h>
using namespace std;
int now_zombies = 0;
int now_WuQi = 0;
bool fuli;
struct Me {
int HP;
int Attack;
int Lvl;
int Exp;
int EXP_MAX;
int QH;
} My;
struct zombie {
int HP;
int Attack;
string Name;
int hard;
} a[10007];
struct WU {
string name;
int add_Att;
int add_HP;
int kind;
bool have;
} w[10007];
struct Ku {
int wuqi_id;
int fangjv_id;
int zuoqi_id;
} WuQi_Ku;
struct SheZhi {
bool Fast;
bool Buff;
bool All;
} SZ;
void cls() {
system("cls");
}
void new_(int hp, int att, string name, int Hard) {
int t = ++now_zombies;
a[t].HP = hp;
a[t].Attack = att;
a[t].Name = name;
a[t].hard = Hard;
}
void _new(string n, int add_1, int add_2, int kinds) {
int t = ++now_WuQi;
w[t].name = n;
w[t].add_Att = add_1;
w[t].add_HP = add_2;
w[t].kind = kinds;
w[t].have = false;
}
int Me_Attack(int x) {
int r = rand() % 100 + 1;
int attack = 1;
if(r <= 20) {
attack = My.Attack * 2;
printf("你:暴击!对敌方造成%d点高额伤害", attack);
return attack;
}
if(r >= 21 && r <= 25) {
attack = My.Attack * 5;
printf("你:大招!对敌方造成%d点爆炸伤害", attack);
return attack;
}
if(r >= 26 && r <= 95) {
attack = My.Attack;
printf("你:对敌方造成%d点伤害", attack);
return attack;
}
if(r >= 96 && r <= 100) {
attack = x / 2;
printf("你:使用毒素攻击!敌方血量减半");
return attack;
}
}
int Di_Attack(int x, int att) {
int r = rand() % 100 + 1;
int attack = 1;
if(r <= 20) {
attack = att * 2;
printf("敌:暴击!对你造成%d点高额伤害", attack);
return attack;
}
if(r >= 21 && r <= 25) {
attack = att * 5;
printf("敌:大招!对你造成%d点爆炸伤害", attack);
return attack;
}
if(r >= 26 && r <= 95) {
attack = att;
printf("敌:对你造成%d点伤害", attack);
return attack;
}
if(r >= 96 && r <= 100) {
attack = x / 2;
printf("敌:使用毒素攻击!你的血量减半");
return attack;
}
}
int Zombie_Attack(int att) {
int r = rand() % 100 + 1;
printf("怪物对你造成%d点伤害", att);
if(r <= 20) {
printf("\n攻击被格挡,伤害减半");
att /= 2;
}
if(r >= 21 && r <= 25) {
printf("\n攻击被闪避");
att = 0;
}
return att;
}
void ccc(string s) {
for(int i = 0; i < s.size(); i++) {
cout << s[i];
Sleep(20);
}
cout << "\n";
}
void slow(string s) {
int f;
if(SZ.Fast) f = 1;
else f = 2;
for(int i = 0; i < s.size(); i++) {
cout << s[i];
Sleep(150 * f);
}
cout << "\n";
}
void Game() {
srand((unsigned)time(NULL));
cls();
ccc("欢迎英雄回家!");
Sleep(1000);
cls();
ccc("请选择你想要操作:");
ccc("1.关卡 2.查看我的信息 3.强化 4.双人对战 5.装备区 6.更新日志 7.新手福利 8.自定义设置");
string s;
cin >> s;
if(s == "1") {
cls();
int t = 0, r = 0;
for(int i = 1; i <= 3; i++) {
cout << "已加载" << i * 30 << "%~\n";
t = r;
r = rand() % 6 + 1;
if(r == t) r = rand() % 6 + 1;
if(r == 1) printf("主线关卡和双人对战获胜均可获得经验值~\n");
if(r == 2) printf("强化可以增加20%的属性~\n");
if(r == 3) printf("毒素非常厉害,可以让怪物血量砍半~\n");
if(r == 4) printf("可以在主页看到自己的等级~\n");
if(r == 5) printf("Boss关卡难度很高,可以重复打之前的关卡升级再打~\n");
if(r == 6) printf("对方的攻击是可能被格挡或闪避的哦~\n");
slow("->->->");
cls();
}
ccc("选择关卡");
for(int i = 1; i <= now_zombies; i++) {
printf("%d. ", i);
cout << a[i].Name;
cout << "\t";
if(i < 6 || i > 9) cout << "\t";
cout << "难度:";
for(int j = 1; j <= a[i].hard; j++) cout << "☆";
cout << "\n";
}
int x;
cin >> x;
if(x < 1 || x > now_zombies) {
cls();
system("color 04");
slow("Error!");
Sleep(1000);
system("color 09");
Game();
}
else {
cls();
slow("战斗准备中~~~");
cout << "\n";
int zombie_HP = a[x].HP;
int zombie_Attack = a[x].Attack;
int My_HP = My.HP;
int My_Attack = My.Attack;
while(1) {
zombie_HP -= Me_Attack(zombie_HP);
printf("\n怪物还剩%d点血\n\n", zombie_HP);
Sleep(1000);
if(zombie_HP <= 0) {
cls();
slow("获得胜利!");
Sleep(1000);
My.Exp += 100 << x + 1;
My.QH += 5 << x - 1;
if(My.Exp >= My.EXP_MAX) {
cls();
slow("升级了");
while(1) {
if(My.Exp >= My.EXP_MAX) {
My.Exp -= My.EXP_MAX;
My.EXP_MAX <<= 1;
My.Lvl++;
My.Attack *= 1.5;
My.HP *= 1.5;
}
else break;
}
printf("你现在%d级", My.Lvl);
Sleep(1000);
}
break;
}
My_HP -= Zombie_Attack(zombie_Attack);
printf("\n你还剩%d点血\n\n", My_HP);
Sleep(1000);
if(My_HP <= 0) {
cls();
slow("You Die!");
My.Exp -= 100 << x - 1;
break;
}
}
Game();
}
}
if(s == "2") {
cls();
ccc("基本信息如下");
printf("\n等级:%d\n经验值:%d\n经验值上限:%d\n攻击力:%d\n生命值:%d\n\n", My.Lvl, My.Exp, My.EXP_MAX, My.Attack, My.HP);
ccc("请按任意键继续~~~");
char c = getch();
Game();
}
if(s == "3") {
cls();
printf("你有%d个强化点,强化需要10强化点\n", My.QH);
Sleep(1000);
if(My.QH < 10) {
ccc("强化点不足,无法进行强化");
Game();
}
ccc("输入:1. 强化攻击 2. 强化生命");
char c = getch();
if(c == '1') My.Attack = My.Attack * 6 / 5;
else My.HP = My.HP * 6 / 5;
My.QH -= 10;
cls();
slow("强化成功!");
Game();
}
if(s == "4") {
cls();
for(int i = 1; i <= 3; i++) {
cout << "正在联网寻找对手";
slow("->->->");
cls();
}
int r = rand() % 10 + 1;
cout << "你 VS ";
if(r == 1) cout << "烟柳一枝花";
if(r == 2) cout << "英雄小五";
if(r == 3) cout << "笑的很甜蜜";
if(r == 4) cout << "北风吹";
if(r == 5) cout << "别打了";
if(r == 6) cout << "你干嘛~";
if(r == 7) cout << "牢大坠机啦!";
if(r == 8) cout << "秋风萧瑟";
if(r == 9) cout << "为神马0505";
if(r == 10) cout << "江洋大盗重彪脸";
Sleep(1000);
cls();
int My_HP = My.HP;
int Di_Att = (rand() % (My.Lvl * 15) + 10) / 5 * 5;
int Di_HP = My.Lvl * 100 - Di_Att;
while(1) {
Di_HP -= Me_Attack(Di_HP);
printf("\n敌方还剩%d点血\n\n", Di_HP);
Sleep(1000);
if(Di_HP <= 0) {
cls();
slow("Win!!!");
My.Exp += 100 << My.Lvl + 1;
My.QH += 5 << My.Lvl - 1;
if(My.Exp >= My.EXP_MAX) {
cls();
slow("升级了");
while(1) {
if(My.Exp >= My.EXP_MAX) {
My.Exp -= My.EXP_MAX;
My.EXP_MAX <<= 1;
My.Lvl++;
My.Attack *= 1.5;
My.HP *= 1.5;
}
else break;
}
printf("你现在%d级", My.Lvl);
Sleep(1000);
}
Game();
}
My_HP -= Di_Attack(My_HP, Di_Att);
printf("\n你还剩%d点血\n\n", My_HP);
Sleep(1000);
if(My_HP <= 0) {
cls();
slow("Lose!!!");
Game();
}
}
}
if(s == "5") {
cls();
ccc("您有如下装备");
cout << "\n";
bool f = false;
for(int i = 1; i <= now_WuQi; i++) {
if(w[i].have) {
cout << w[i].name << "\t攻击:" << w[i].add_Att << " 生命:" << w[i].add_HP << "\n";
f = true;
}
}
if(!f) {
Sleep(1000);
ccc("啊嘞?空空如也");
}
cout << "\n";
ccc("已装备:");
int t1 = WuQi_Ku.wuqi_id, t2 = WuQi_Ku.fangjv_id, t3 = WuQi_Ku.zuoqi_id;
cout << "武器:" << w[t1].name << "\n";
cout << "防具:" << w[t2].name << "\n";
cout << "坐骑:" << w[t3].name << "\n";
ccc("你要装上装备吗?(Y/N)");
char c = getch();
if(c == 'Y') {
cls();
ccc("装上哪个编号的?");
for(int i = 1; i <= now_WuQi; i++) {
cout << i << ". " << w[i].name << setw(20) << "拥有状态:";
if(w[i].have) cout << "Yes";
else cout << "No";
cout << "\n";
}
int x;
cin >> x;
if(!w[x].have) {
cls();
ccc("你未拥有");
Sleep(1000);
Game();
}
if(w[x].kind == 1) {
WuQi_Ku.wuqi_id = x;
My.Attack += w[x].add_Att;
My.HP += w[x].add_HP;
}
if(w[x].kind == 2) {
WuQi_Ku.fangjv_id = x;
My.Attack += w[x].add_Att;
My.HP += w[x].add_HP;
}
if(w[x].kind == 3) {
WuQi_Ku.zuoqi_id = x;
My.Attack += w[x].add_Att;
My.HP += w[x].add_HP;
}
Game();
}
else Game();
}
if(s == "6") {
cls();
ccc("v1.0.0 最基本的游戏");
ccc("v1.0.3 加载画面修改");
ccc("v1.1.2 新增强化功能");
ccc("v1.1.5 修复已知问题,初始化界面修改");
ccc("v1.1.9 增加关卡到10个");
ccc("v1.3.1 增加双人对战模式");
ccc("v1.4.9 增加武器库功能");
ccc("v1.5.1 新增新人福利活动");
ccc("v1.6.3 新增自定义设置");
ccc("请按任意键继续~~~");
char c = getch();
Game();
}
if(s == "7") {
cls();
if(fuli) {
slow("已领取~");
Sleep(1000);
Game();
}
ccc("推出新人福利活动!十件超强装备随机派送!");
ccc("请按任意键领取");
char c = getch();
cls();
slow("恭喜获得");
int r = rand() % now_WuQi + 1;
cout << w[r].name << "!";
ccc("奖励已经发放到武器库~");
w[r].have = true;
fuli = true;
Sleep(3000);
Game();
}
if(s == "8") {
cls();
ccc("可设置:1.快速加载 2.外挂模式(关闭将初始化) 3.满装备模式");
string x;
cin >> x;
if(x == "1") {
if(SZ.Fast) {
ccc("已关闭快速加载");
SZ.Fast = false;
}
else {
ccc("已开启快速加载");
SZ.Fast = true;
}
Sleep(1000);
}
if(x == "2") {
if(SZ.Buff) {
ccc("已关闭外挂模式");
SZ.Buff = false;
My.Attack = 10;
My.HP = 100;
}
else {
ccc("已开启外挂模式");
SZ.Buff = true;
My.Attack = 114514;
My.HP = 114514;
}
Sleep(1000);
}
if(x == "3") {
if(SZ.All) {
ccc("已关闭满装备模式");
SZ.All = false;
for(int i = 1; i <= now_WuQi; i++) w[i].have = false;
}
else {
ccc("已开启满装备模式");
SZ.All = true;
for(int i = 1; i <= now_WuQi; i++) w[i].have = true;
}
Sleep(1000);
}
Game();
}
}
void My_inti() {
My.Attack = 10;
My.HP = 100;
My.Lvl = 1;
My.Exp = 0;
My.EXP_MAX = 1000;
My.QH = 0;
}
void zombies_inti() {
new_(100, 10, "Cai XuKun", 1);
new_(250, 25, "Lao Da", 2);
new_(500, 30, "Ri Ben", 3);
new_(600, 50, "Lao Liu", 3);
new_(1000, 88, "Little Boss", 4);
new_(1200, 100, "Chinese Teacher", 5);
new_(500, 300, "Maths Teacher", 5);
new_(2000, 50, "English Teacher", 5);
new_(1500, 150, "I Have No NAME", 5);
new_(3000, 300, "BIG BOSS!!!", 7);
}
void WuQi_inti() {
w[0].name = "Null";
_new("AK-47", 35, 0, 1);
_new("Ba Zu KA", 100, -75, 1);
_new("Qing Hong Sword", 30, 0, 1);
_new("Green Dragon Crescent Blade", 50, -20, 1);
_new("AUG", 35, 0, 1);
_new("Gold Beetle", 20, 100, 2);
_new("Rattan Beetle", 0, 150, 2);
_new("Di Du Horse", -10, 150, 3);
_new("Chi Tu Horse", 10, 100, 3);
_new("Plane", 500, 10000, 3);
WuQi_Ku.wuqi_id = WuQi_Ku.fangjv_id = WuQi_Ku.zuoqi_id = 0;
}
void inti() {
zombies_inti();
My_inti();
WuQi_inti();
system("color 09");
slow("By GuWenBo");
Sleep(1000);
cls();
for(int i = 1; i <= 2; i++) {
cls();
cout << "Loading~~~\n";
slow("->->->");
}
Sleep(300);
Game();
}
int main() { inti();}
开局一个卒,士兵全靠买!
// By School //
#include <bits/stdc++.h>
#include <windows.h>
#include <conio.h>
using namespace std;
void ccc(); // 匀速输出
void c_slow(); // 缓慢输出
void cls(); // 清屏
void Error(); // 输出"Input Error"
void zhuye(); // 主界面
void inti(); // 初始化
long long money;
long long bing_1,bing_2 = 1,bing_3;
long long my_shili;
void ccc(string s) { // 匀速输出
for(int i = 0; i < s.size(); i++) {
cout << s[i];
Sleep(25);
}
printf("\n");
}
void c_slow(string s) { // 缓慢输出
for(int i = 0; i < s.size(); i++) {
cout << s[i];
Sleep(444);
}
printf("\n");
}
void cls() { // 清屏
system("cls");
}
void Error() { // 输出"Input Error"
cls();
c_slow("Input Error!");
zhuye();
}
void zhuye() { // 主界面
cls();
ccc("1.说明 2.商店 3.征战 4.我的资料 5.礼包码");
char s = getch();
if(s == '1') {
cls();
ccc("版本号: v.1.06 ");
ccc("征战获得钱");
ccc("钱买士兵");
ccc("按任意键继续");
char a = getch();
zhuye();
} else if(s == '2') {
cls();
ccc("1.普通士兵 10 元 一个 2. 中级士兵 66 元一个 3.高级士兵 111元一个 4.返回");
char a = getch();
if(a == '4') zhuye();
if(a == '1') {
ccc("输入个数");
printf("你有%lld元",money);
int num;
cin >> num;
if(money >= num * 10) {
money -= num * 10;
bing_1 += num;
ccc("购买成功!");
zhuye();
} else Error();
}
if(a == '3') {
ccc("输入个数");
printf("你有%lld元",money);
int num;
cin >> num;
if(money >= num * 111) {
money -= num * 111;
bing_3 += num;
ccc("购买成功!");
zhuye();
} else Error();
}
if(a == '2') {
ccc("输入个数");
printf("你有%lld元",money);
int num;
cin >> num;
if(money >= num * 66) {
money -= num * 66;
bing_2 += num;
ccc("购买成功!");
zhuye();
} else Error();
}
} else if(s == '3') {
cls();
my_shili = bing_1 * 3 + bing_2 * 10 + bing_3 * 30;
printf("我方战力:%lld\n",my_shili);
ccc("输入敌人等级(1 ~ 50)");
int num; cin >> num;
if(num < 1 || num > 50) Error();
long long di_shili = pow(2,num);
while(1){
if(di_shili <= 0) {
cls();
ccc("You Win!");
money += pow(3,num);
printf("你获得了");
cout << pow(3,num);
printf("元!\n");
Sleep(1000);
zhuye();
} if(my_shili <= 0) {
cls();
ccc("你全军覆没了!");
Sleep(1000);
ccc("你在混乱中被杀");
cls();
c_slow("You Are Die!");
Sleep(500);
inti();
}
printf("敌方战力:%lld\n",di_shili);
printf("我方战力:%lld\n",my_shili);
ccc("1.攻击 2.逃跑");
char a = getch();
if(a == '2') zhuye();
if(a == '1') {
if(my_shili >= di_shili) {
bing_1 = ceil(bing_1 * 1.0 / 1.5);
bing_2 = ceil(bing_2 * 1.0 / 1.25);
bing_3 = ceil(bing_3 * 1.0 / 1.125);
my_shili = bing_1 * 3 + bing_2 * 10 + bing_3 * 30;
di_shili /= 3;
} else {
bing_1 /= 2.5;
bing_2 /= 2;
bing_3 /= 1.5;
my_shili = bing_1 * 3 + bing_2 * 10 + bing_3 *30;
di_shili /= 1.5;
}
}
}
} else if(s == '4') {
cls();
printf("金币:%lld\n", money);
printf("普通士兵:%lld\n", bing_1);
printf("中级士兵:%lld\n", bing_2);
printf("高级士兵:%lld\n", bing_3);
printf("战力值:%lld\n", bing_1 * 3 + bing_2 * 10 + bing_3 * 30);
ccc("按任意键继续");
char a = getch(); zhuye();
} else if(s == '5') {
cls();
ccc("输入兑换码");
string a; getline(cin,a);
if(a == "HAPPY666") {
cls();
ccc("恭喜获得:200元");
money += 200;
Sleep(500);
zhuye();
} if(a == "School666") {
cls();
ccc("恭喜获得:20名中级士兵");
bing_2 += 20;
Sleep(500);
zhuye();
} if(a == "C++666") {
cls();
ccc("恭喜获得:6名高级士兵");
bing_3 += 6;
Sleep(500);
zhuye();
} if(a == "DevC++666") {
cls();
ccc("恭喜获得:66名低级士兵");
bing_1 += 66;
Sleep(500);
zhuye();
} else Error();
} else Error();
}
void inti() { // 初始化
cls();
system("color 09");
c_slow("By School");
Sleep(500);
cls();
c_slow("Loading……");
Sleep(500);
zhuye();
}
int main() { inti(); } // main()函数好像没用……
最强指挥官
// By School //
#include <bits/stdc++.h>
#include <windows.h>
#include <conio.h>
using namespace std;
void ccc(string s);
void c_slow(string s);
void cls();
void Error();
void zhuye();
void inti();
long long lvl = 1;
long long sum;
long long money = 50;
long long wuqi = 5;
long long MAX_SUM = 10;
void ccc(string s) {
for(int i = 0; i < s.size(); i++) {
cout << s[i];
Sleep(25);
}
cout << "\n";
}
void c_slow(string s) {
for(int i = 0; i < s.size(); i++) {
cout << s[i];
Sleep(444);
}
cout << "\n";
}
void cls() {
system("cls");
}
void Error() {
cls();
c_slow("Input Error!");
Sleep(500);
zhuye();
}
void zhuye() {
cls();
ccc("1.教程 2.征战 3.升级 4.招募 5.我的信息");
char a = getch();
if(a == '1') {
cls();
ccc("每次征战会获得财宝和武器");
ccc("财宝和武器到达一定数量可以升级军队等级");
ccc("军队等级的升级会大幅增加士兵上限和士兵战斗力");
ccc("加油吧,指挥官!");
ccc("请按任意键继续");
char n = getch();
zhuye();
}
else if(a == '2') {
cls();
ccc("输入等级 (<=50) 输入0返回");
int n;
cin >> n;
if(n == 0) zhuye();
cls();
printf("敌方士兵数:");
cout << pow(3,n) << "\n";
printf("我方士兵数:%d\n",sum);
printf("敌方等级:%d\n",n);
printf("我方等级:%d\n",lvl);
ccc("指挥官,是否发动进攻? 输入'Y'或'N' Y代表攻击 N代表逃跑");
char num = getch();
if(num == 'Y') {
if((pow(3,n) * pow(2,lvl) < sum * pow(2,lvl))) {
cls();
c_slow("You Win!");
ccc("恭喜收获:");
printf("\t"); cout << pow(5,n + 1) << "元\n";
printf("\t"); cout << pow(10,n - 1) << "把武器\n";
printf("\t"); cout << floor(pow(3,n) / 5) << "名俘虏\n";
ccc("请按任意键继续");
char s = getch();
money += pow(5,n + 1);
wuqi += pow(10,n - 1);
sum += pow(3,n) / 5;
zhuye();
} else { ccc("You Lose!"); zhuye(); }
}
else if(num == 'N') {
cls();
ccc("你损失了一些军费!");
printf("损失了:"); cout << pow(10,n) << "元"; money -= pow(10,n);
Sleep(1000);
zhuye();
}
else Error();
}
else if(a == '3') {
cls();
printf("你的当前等级是%d,升级需要",lvl);
cout << pow(20,lvl + 1);
printf("元和");
cout << pow(3,lvl + 1);
printf("把武器\n");
ccc("是否购买? Please Input 'Y' or 'N'");
char n = getch();
if(n == 'Y') {
if(money < pow(20,lvl + 1)) {
cls();
ccc("You Don't Have Enough Money!");
zhuye();
} else if(wuqi < pow(3,lvl + 1)) {
cls();
ccc("You Don't Have Enough Weapon!");
zhuye();
} else {
money -= pow(20,lvl + 1);
wuqi -= pow(10,lvl);
lvl++;
MAX_SUM *= 5;
ccc("OK!");
Sleep(500);
zhuye();
}
}
else if(n == 'N') zhuye();
else Error();
}
else if(a == '4') {
cls();
printf("招募一个士兵需要");
cout << pow(10,lvl);
printf("元,一把武器\n");
ccc("你要多少? 输入数字 输入-1可以购买最大上限个士兵");
int n;
cin >> n;
if(n == -1) {
int n1 = (money / (pow(10,lvl))), n2 = wuqi;
int num = min(n1,n2); int k = MAX_SUM - sum; if(num > k) num = k;
money -= num * pow(10,lvl);
wuqi -= num;
sum += num;
cls();
ccc("OK!");
printf("购买了%d个士兵",num);
Sleep(500);
zhuye();
}
else if(money < pow(10,lvl) * n) {
cls();
ccc("You Don't Have Enough Money!");
zhuye();
}
else if(wuqi < n) {
cls();
ccc("You Don't Have Enough Weapon!");
zhuye();
}
else if(sum + n > MAX_SUM) {
cls();
ccc("It Is So Big! Please add your level");
zhuye();
}
else {
sum += n;
money -= pow(10,lvl) * n;
cls();
ccc("OK!");
Sleep(500);
zhuye();
}
}
else if(a == '5') {
cls();
printf("等级:%d\n",lvl);
printf("士兵数量:%d\n",sum);
printf("士兵上限:%d\n",MAX_SUM);
printf("钱:%d\n",money);
printf("武器数量:%d\n",wuqi);
ccc("请按任意键继续");
char n = getch();
zhuye();
}
else Error();
}
void inti() {
system("color 09");
c_slow("By School");
cls();
c_slow("Loading……");
cls();
zhuye();
}
int main() { inti(); }
猜数游戏
// By School //
#include <bits/stdc++.h>
#include <windows.h>
using namespace std;
void cls() {
system("cls");
}
int power(int n) {
long long s = 1,i = 0;
while(s < n) {
s *= 2;
i++;
}
return i;
}
void ccc(string s) {
for(int i = 0; i < s.size(); i++) {
cout << s[i];
Sleep(25);
}
cout << "\n";
}
void c_slow(string s) {
for(int i = 0; i < s.size(); i++) {
cout << s[i];
Sleep(444);
}
cout << "\n";
}
int main() {
cls();
ccc("输入范围 输入0关闭");
int n;
cin >> n;
if(n == 0)
return 0;
cls();
srand((unsigned)time(NULL));
printf("范围为 1 ~ %d\n",n);
long long s = power(n);
long long ans = rand() % n + 1;
printf("你最少要猜%d次,更少算我输!\n",s);
ccc("猜吧");
long long sum = 1;
while(1) {
int x;
cin >> x;
if(x > ans) {
ccc("大了");
sum++;
}
else if(x < ans) {
ccc("小了");
sum++;
}
else {
cls();
c_slow("Yes!");
printf("你用了%d次!",sum);
break;
}
}
return 0;
}
版权声明:本文标题:C++小游戏合集 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://it.en369.cn/jiaocheng/1754767147a2725833.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。


发表评论