手作小代码
2026-06-26 22:05:31
发布于:福建
em……对是写出来了,这是内测版本,有问题或建议发在这里评论,我会后期做出来的
#include <bits/stdc++.h>
#include <windows.h>
#include <ctime>
using namespace std;
string cj[10000] = {"第一次", "问题小家", "深入探究", "好奇小子", "**之神", "太倒霉了", "隐藏成就"};
long long ask = 0;
bool flag_first = false;
bool flag_wtxj = false;
bool flag_srtj = false;
bool flag_yccj = false;
bool flag_hqxz = false;
bool flag_dbzs = false;
bool flag_tdml = false;
long long cnt_first = 0;
int a[10000000] , b[100000000] , c[100000000];
void game() {
int RightNumber = rand() % 100 + 1;
cout << "欢迎来到猜数字游戏" << endl;
cout << "我已经想好了一个1到100之间的数字。你有 10 次机会来猜到它。" << endl;
int guess = 0;
int cs = 0;
while (cs < 10) {
cout << "请输入你猜的数字: ";
cin >> guess;
cs++;
if (guess == RightNumber) {
cout << "恭喜你猜对了!你用了 " << cs << " 次尝试。" << endl;
break;
} else if (guess > RightNumber) {
cout << "猜大了!" << endl;
} else {
cout << "猜小了!" << endl;
}
}
if (cs == 1) {
cout << "恭喜您获得-**之神的成就" << endl;
flag_dbzs = true;
}
if (cs == 10 && guess != RightNumber) {
cout << "很遗憾,机会用完了!正确的数字是 " << RightNumber << "。" << endl;
cout << "恭喜您获得-太倒霉了的成就" << endl;
flag_tdml = true;
}
}
void add(string x , string y) {
int la = x.length();
int lb = y.length();
int lc = max(la , lb);
memset(a , 0 , sizeof a);
memset(b , 0 , sizeof b);
memset(c , 0 , sizeof c);
for (int i = 0 ; i < la ; i++) {
a[i] = x[la - 1 - i] - '0';
}
for (int i = 0 ; i < lb ; i++)
b[i] = y[lb - 1 - i] - '0';
for (int i = 0 ; i < lc ; i++) {
c[i] += a[i] + b[i];
c[i + 1] = c[i] / 10;
c[i] %= 10;
}
if (c[lc]) {
lc++;
}
for (int i = lc - 1 ; i >= 0 ; i--) {
cout << c[i];
}
cout << endl;
}
void sub(string x , string y) {
bool is_neg = false;
if (x.size() < y.size() || (x.size() == y.size() && x < y)) {
swap(x , y);
is_neg = true;
}
int la = x.size();
int lb = y.size();
int lc = max(la , lb);
memset(a , 0 , sizeof a);
memset(b , 0 , sizeof b);
memset(c , 0 , sizeof c);
for (int i = 0 ; i < la ; i++) {
a[la - 1 - i] = x[i] - '0';
}
for (int i = 0 ; i < lb ; i++) {
b[lb - 1 - i] = y[i] - '0';
}
for (int i = 0 ; i < lc ; i++) {
c[i] += a[i] - b[i];
if (c[i] < 0) {
c[i + 1] -= 1;
c[i] += 10;
}
}
while (lc > 1 && c[lc - 1] == 0) {
lc--;
}
if (is_neg) {
cout << '-';
}
for (int i = lc - 1; i >= 0; i--) {
cout << c[i];
}
cout << endl;
}
void mul(string x , string y) {
int la = x.size();
int lb = y.size();
int lc = la + lb;
memset(a , 0 , sizeof a);
memset(b , 0 , sizeof b);
memset(c , 0 , sizeof c);
for (int i = 0; i < la; i++) {
a[la - 1 - i] = x[i] - '0';
}
for (int i = 0; i < lb; i++) {
b[lb - 1 - i] = y[i] - '0';
}
for (int i = 0; i < la; i++) {
for (int j = 0; j < lb; j++) {
c[i + j] += a[i] * b[j];
}
}
for (int i = 0 ; i < lc ; i++) {
c[i + 1] += c[i] / 10;
c[i] %= 10;
}
while (lc > 1 && c[lc - 1] == 0) {
lc--;
}
for (int i = lc - 1; i >= 0; i--) {
cout << c[i];
}
cout << endl;
}
void div(string x , long long b) {
if (b == 0) {
cout << "除数不能为0!" << endl;
return;
}
int la = x.size();
int lc = la;
memset(a, 0, sizeof a);
memset(c, 0, sizeof c);
for (int i = 0 ; i < la ; i++) {
a[la - 1 - i] = x[i] - '0';
}
long long tmp = 0;
for (int i = la - 1 ; i >= 0 ; i--) {
tmp = tmp * 10 + a[i];
c[i] = tmp / b;
tmp %= b;
}
while (lc > 1 && c[lc - 1] == 0) {
lc--;
}
for (int i = lc - 1 ; i >= 0 ; i--) {
cout << c[i];
}
cout << endl;
}
int main() {
srand(time(0));
while (true) {
cout << "----------------------------------------------" << endl;
cout << "|欢迎使用C++做成的用处小多的一款多功能代码1.0|" << endl;
cout << "| 请问您要用什么功能呢? |" << endl;
cout << "| A.计算机 |" << endl;
cout << "| B.计时器 |" << endl;
cout << "| C.小游戏 |" << endl;
cout << "| D.版本信息 |" << endl;
cout << "| E.成就信息 |" << endl;
cout << "| F.隐藏密码 |" << endl;
cout << "| G.更新记录 |" << endl;
cout << "| 如果你想给我投稿,您可以登录这个网址评论 |" << endl;
cout << "| https://www.acgo.cn/discuss/rest/83887 |" << endl;
cout << "----------------------------------------------" << endl;
if (cnt_first == 0) {
cout << "恭喜你获得-第一次的成就" << endl;
flag_first = true;
cnt_first = 1;
}
if (ask >= 10 && !flag_wtxj) {
cout << "恭喜你获得-问题小家的成就" << endl;
flag_wtxj = true;
}
if (ask >= 50 && !flag_srtj) {
cout << "恭喜获得-深入探究的成就" << endl;
flag_srtj = true;
}
string in;
cin >> in;
if (in == "A") {
cout << "--------------------" << endl;
cout << "|请问你是要做什么呢|" << endl;
cout << "| A.加法|" << endl;
cout << "| B.减法|" << endl;
cout << "| C.乘法|" << endl;
cout << "| D.除法|" << endl;
cout << "| E.开根|" << endl;
cout << "| F.平方|" << endl;
cout << "--------------------" << endl;
string inA;
cin >> inA;
if (inA == "A") {
cout << "请输入你的两个数字:" << endl;
string a, b;
cin >> a >> b;
cout << a << "+" << b << "=";
add(a , b);
ask++;
}
if (inA == "B") {
cout << "请输入你的两个数字:" << endl;
string a , b;
cin >> a >> b;
cout << a << "-" << b << "=";
sub(a , b);
ask++;
}
if (inA == "C") {
cout << "请输入你的两个数字:" << endl;
string a , b;
cin >> a >> b;
cout << a << "x" << b << "=";
mul(a , b);
ask++;
}
if (inA == "D") {
cout << "请输入你的两个数字:" << endl;
string a;
long long b;
cin >> a >> b;
if (b == 0) {
cout << "0不能做为被除数!" << endl;
} else {
cout << a << "除以" << b << " = " ;
div(a , b);
}
ask++;
}
if (inA == "E") {
cout << "请你输入一个数字:" << endl;
long long n;
cin >> n;
cout << fixed << setprecision(100) << sqrt(n) << endl;
ask++;
}
if (inA == "F") {
cout << "请你输入一个数字:" << endl;
long long n;
cin >> n;
cout << "请输入您需要多少次的次方" << endl;
long long cf;
cin >> cf;
n = pow(n, cf);
cout << n << endl;
ask++;
}
}
if (in == "B") {
unsigned long long a, b, c, sum;
printf("你要我多久后提醒你? (时 分 秒,例如 0 5 0)\n");
scanf("%llu%llu%llu", &a, &b, &c);
sum = a * 3600 + b * 60 + c;
system("cls");
printf("计时开始!");
Sleep(1000);
system("cls");
while (sum > 0) {
printf("还剩 %llu 时 %llu 分 %llu 秒\n", sum / 3600, sum / 60 % 60, sum % 60);
Sleep(1000);
system("cls");
sum--;
}
MessageBox(NULL, "时间到喽!", "计时器", MB_OK);
}
if (in == "C") {
game();
}
if (in == "D") {
cout << "该版本为内测版本" << endl;
cout << "后期我会有更多功能" << endl;
flag_hqxz = true;
}
if (in == "E") {
cout << "----------------" << endl;
cout << "| 请选择 |" << endl;
cout << "| A.获取方法 |" << endl;
cout << "| B.目前成就 |" << endl;
cout << "----------------" << endl;
string inE;
cin >> inE;
if (inE == "A") {
cout << "成就高低分层:白色,绿色,蓝色,紫色,金色,红色以及打加号的红色成就" << endl;
cout << "你需要知道哪些颜色的成就呢?" << endl;
cout << "注意:你只能输入白色、绿色、蓝色、紫色、金色、红色、+红色";
string inE_A;
cin >> inE_A;
if (inE_A == "白色") {
cout << "白色成就有以下几个" << endl;
cout << "第一次:只要打开一次电脑就行了pro" << endl;
cout << "好奇小子:打开一次版本信息" << endl;
}
if (inE_A == "绿色") {
cout << "绿色成就有以下几个" << endl;
cout << "问题小家:提问10个问题" << endl;
cout << "太倒霉了:在猜数字游戏中一次都没猜中" << endl;
}
if (inE_A == "蓝色") {
cout << "蓝色成就有以下几个" << endl;
cout << "深入探究:提问50个问题" << endl;
}
if (inE_A == "紫色") {
cout << "暂无";
}
if (inE_A == "金色") {
cout << "暂无" << endl;
}
if (inE_A == "红色") {
cout << "绿色成就有以下几个" << endl;
cout << "**之神:在猜数字游戏中一次就猜到了" << endl;
}
if(inE_A == "+红色") {
cout << "+红色成就有以下几个" << endl;
cout << "隐藏成就:???" << endl;
}
}
if (inE == "B") {
cout << "目前你获得成就有:" << endl;
if (flag_first) cout << "第一次" << endl;
if (flag_wtxj) cout << "问题小家" << endl;
if (flag_srtj) cout << "深入探究" << endl;
if (flag_hqxz) cout << "好奇小子" << endl;
if (flag_dbzs) cout << "**之神" << endl;
if (flag_tdml) cout << "太倒霉了" << endl;
if (flag_yccj) cout << "隐藏成就 - 内测先锋" << endl;
cout << "目前你没有的成就有:" << endl;
if (!flag_first) cout << "第一次" << endl;
if (!flag_wtxj) cout << "问题小家" << endl;
if (!flag_srtj) cout << "深入探究" << endl;
if (!flag_hqxz) cout << "好奇小子" << endl;
if (!flag_dbzs) cout << "**之神" << endl;
if (!flag_tdml) cout << "太倒霉了" << endl;
if (!flag_yccj) cout << "隐藏成就 - 内测先锋" << endl;
}
}
if (in == "F") {
cout << "请输入密码" << endl;
string password;
cin >> password;
if (password == "我是内测就开始使用的人,给我这个成就吧") {
cout << "恭喜您获得隐藏成就" << endl;
flag_yccj = true;
} else {
cout << "密码都输错了,想拿奖励想屁吃" << endl;
}
}
if (in == "G") {
cout << "这是内测版本,所以还没有哦" << endl;
}
}
return 0;
}
这里空空如也


















有帮助,赞一个