Files
2026-05-16 11:09:02 +08:00

100 lines
3.4 KiB
C++
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#include <iostream>
#include <cstdlib>
#include <ctime>
void draw_once() {
int r = std::rand() % 111;
if (r < 50) std::cout << "R\n";
else if (r < 80) std::cout << "SR\n";
else if (r < 100) std::cout << "SSR\n";
else if (r < 105) std::cout << "UR\n";
else if (r < 109) std::cout << "TR\n";
else std::cout << "USR\n";
}
int main() {
int coins = 0;
std::srand(std::time(nullptr));
while (true) {
flag:
std::cout << "现在有:" << coins << "金币" << "\n";
std::cout << "\n===== 抽卡小游戏 =====\n";
std::cout << "1 抽一次\n";
std::cout << "2 说明\n";
std::cout << "3 增加金币\n";
std::cout << "4 稀有度查看\n";
std::cout << "0 退出\n";
std::cout << "请选择:";
int choice = 0;
std::cin >> choice;
if (choice == 1){
std::cout << "抽几次?(最大100" << "\n";
int n = 0;
std::cin >> n;
if (coins < n*10){
std::cout << "金币不足,请增加金币,或者减少遍数" << "\n";
std::cout << "将跳转到菜单,请按回车" << "\n";
std::cin.ignore();
std::cin.get();
continue;
}
for ( int i =1; (i <= n && i <= 100 && n<=100 ); i++)
{
std::cout << "第" << i << "抽";
draw_once();
coins -= 10;
}
}
if (choice == 2){
std::cout << "说明:这是一个抽卡游戏,你可以通过抽卡来获得各种等级的卡牌。\n"
"有普通稀有传说,并且还可以查看稀有度分配,每抽一次花费10金币。\n"
"若金币不够,可以去菜单增加金币,或者减少抽卡遍数。并且抽卡遍数最高100。\n";
std::cout << "将跳转到菜单,请按回车" << "\n";
std::cin.ignore();
std::cin.get();
continue;
break;
}
if (choice == 3){
std::cout << "请输入增加金币的数量(最大10000)" << "\n";
int add = 0;
std::cin >> add;
coins += add;
std::cout << "增加成功,现在有:" << coins << "金币" << "\n";
std::cout << "将跳转到菜单,请按回车" << "\n";
std::cin.ignore();
std::cin.get();
continue;
break;
} if (choice == 4){
std::cout <<"R45.05% SR27.03% SSR18.02% UR4.50% TR3.60% USA1.80%\n";
std::cout << "将跳转到菜单,请按回车" << "\n";
std::cin.ignore();
std::cin.get();
continue;
break;
}
if (choice == 0){
choice:
std::cout << "你确定吗?(确定选0 返回菜单选1)" << "\n";
int confirm = 0;
std::cin >> confirm;
if (confirm == 0){
goto end;
}
else if (confirm == 1){
goto flag;
}
else{
std::cout << "输入错误,请重新输入。" << "\n";
goto choice;
}
}
std::cout << "将跳转到菜单,请按回车" << "\n";
std::cin.ignore();
std::cin.get();
continue;
}
end:
return 0;
}