赞
踩
- // 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();
- 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;
- }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。