#include<bits/stdc++.h>
#include<windows.h>
using namespace std;
string name,my,l,name2,my2; //账号及密钥
int jb,jiedu; //jb=金币
string lock(string a){ //账号加密
srand(time(0));
int n,t,i;
string s;
t=rand()%10+1;
n=a.length();
for (i=0;i<n;i++){
s+=char(a[i]+t);
}
s+=char(t+'0');
return s;
}
string unlock(string a){ //账号解密
int n,t,i;
string s;
n=a.length();
t=a[n-1]-'0';
for (i=0;i<n-1;i++){
s+=char(a[i]-t);
}
return s;
}
void dz(){ //打字赚钱分页
system("cls");
srand(time(0));
string s,s2;
int x,i,t; //x=字数 ,t随机
cout<<"你要打几个字?最多100个"<<endl;
cin>>x;
if (x<1 || x>100){
cout<<"字数错误,请重新输入"<<endl;
cout<<"按任意键继续"<<endl;
cin>>l;
dz();
}
for (i=0;i<x;i++){
t=rand()%2;
if (t==0){
t=rand()%26+'A';
s+=char(t);
}
if (t==1){
t=rand()%26+'a';
s+=char(t);
}
}
cout<<"请照打!"<<s;
cin>>s2;
if (s==s2){
cout<<"输对了,获得"<<x<<"元。"<<endl;
jb+=x;
}
else {
cout<<"输错了,你什么也没有得到。"<<endl;
}
cout<<"按任意键返回主页"<<endl;
cin>>l;
system("cls");
return;
}
void js(){ //计算赚钱
system("cls");
int a,b,i,c,n,ans,q;
cout<<"你要做几道计算题?最多100道";
cin>>n;
if (n<1 || n>100){
cout<<"题目数错误,请重新输入"<<endl;
cout<<"按任意键继续"<<endl;
cin>>l;
js();
}
for (i=1;i<=n;i++){
c=rand()%3;
if (c<2){
a=rand()%1000;
b=rand()%1000;
if (c==0) cout<<a<<"+"<<b<<"=?"<<endl;
else cout<<a<<"-"<<b<<"=?"<<endl;
cin>>ans;
if (c==0){
if (ans==a+b) {
cout<<"正确!"<<endl;
q++;
}
else cout<<"错误!"<<endl;
}
else {
if (ans==a-b) {
cout<<"正确!"<<endl;
q++;
}
else cout<<"错误!"<<endl;
}
}
else{
a=rand()%10+1;
b=rand()%99+1;
if (c==2) cout<<a<<"*"<<b<<"=?"<<endl;
else cout<<a*b<<"/"<<a<<"=?"<<endl;
cin>>ans;
if (c==2){
if (ans==a*b) {
cout<<"正确!"<<endl;
q++;
}
else cout<<"错误!"<<endl;
}
else {
if (ans==b) {
cout<<"正确!"<<endl;
q++;
}
else cout<<"错误!"<<endl;
}
}
}
cout<<"你做对了"<<q<<"道题,获得"<<q<<"元"<<endl;
jb+=q;
cout<<"按任意键返回主页"<<endl;
cin>>l;
return;
}
void zq(){ //赚钱分页
int n;
cout<<"请输入:"<<endl;
cout<<"1=打字赚钱"<<endl;
cout<<"2=计算赚钱"<<endl;
cin>>n;
if (n==1) dz();
if (n==2) js();
return;
}
void lh(){ //老虎机分页
system("cls");
cout<<"一百元一次"<<endl;
cout<<"三个相同数字返还10000元"<<endl;
cout<<"两个相同数字返还100元"<<endl;
cout<<"是否要购买?"<<endl;
cout<<"1=购买"<<endl;
cout<<"2=退出"<<endl;
int n;
cin>>n;
if (n==2) return;
if (jb<100){
system("cls");
cout<<"你的钱不够"<<endl;
cout<<"按任意键返回主页"<<endl;
cin>>l;
}
else {
system("cls");
jb-=100;
int a,b,c;
a=rand()%9;
b=rand()%9;
c=rand()%9;
cout<<"你的号码是"<<a<<b<<c<<endl;
if (a==b==c){
cout<<"恭喜获得10000元!"<<endl;
jb+=10000;
cout<<"按任意键返回主页"<<endl;
cin>>l;
}
else if (a==b || b==c || a==c){
cout<<"恭喜获得100元!"<<endl;
jb+=100;
cout<<"按任意键返回主页"<<endl;
cin>>l;
}
else {
cout<<"你什么都没有得到"<<endl;
cout<<"按任意键返回主页"<<endl;
cin>>l;
}
}
}
void cp(){
system("cls");
srand(time(0));
cout<<"彩票两元一次"<<endl;
cout<<"按1开始"<<endl;
char n;
cin>>n;
if (n!='1') return;
if (jb<2){
system("cls");
cout<<"你的钱不够"<<endl;
cout<<"按任意键返回主页"<<endl;
cin>>l;
return;
}
jb-=2;
cout<<"一个数相同可以获得10元"<<endl;
cout<<"两个数相同可以获得100元"<<endl;
cout<<"三个数相同可以获得1000元"<<endl;
cout<<"四个数相同可以获得10000元"<<endl;
cout<<"五个数相同可以获得100000元"<<endl;
cout<<"六个数相同可以获得1000000元"<<endl;
cout<<"一共六个号码,每个号码的大小在1~30之间"<<endl;
cout<<"顺序不同不算相同"<<endl;
cout<<"请输入,中间用空格隔开"<<endl;
int a,i,b[7],ans=1;
for (i=1;i<=6;i++){
cin>>a;
b[i]=rand()%30+1;
if (a==b[i]) ans*=10;
}
cout<<"中奖号码为:";
for (i=1;i<=6;i++){
cout<<b[i]<<" ";
}
cout<<endl;
if (ans==1){
cout<<"你什么都没有得到"<<endl;
}
else {
cout<<"你获得了"<<ans<<"元"<<endl;
jb+=ans;
}
cout<<"按任意键返回主页"<<endl;
cin>>l;
}
void db(){ //赌博分页
int n;
cout<<"请输入:"<<endl;
cout<<"1=购买彩票"<<endl;
cout<<"2=老虎机"<<endl;
cin>>n;
if (n==1) cp();
if (n==2) lh();
}void zhuanban(){
}
void zhuye(){ //主页
int n;
system("cls");
cout<<"请输入:"<<endl;
cout<<"1=赚钱"<<endl;
cout<<"2=查看钱数和饥饿度"<<endl;
cout<<"3=查看版本更新"<<endl;
cout<<"4=赌博"<<endl;
cout<<"5=7月专版"<<endl;
cout<<"6=离开"<<endl;
cin>>n;
if (n==1) {
system("cls");
zq();
zhuye();
}
if (n==2) {
system("cls");
cout<<"你现在有"<<jb<<"元钱"<<endl;
cout<<"按任意键返回主页"<<endl;
cin>>l;
zhuye();
}
if (n==3){
system("cls");
cout<<"v1.1:新增存档系统"<<endl;
cout<<"v1.2:新增计算赚钱并优化已知问题"<<endl;
cout<<"v1.3:新增赌博赚钱"<<endl;
cout<<"v1.3.1:修复一些已知问题"<<endl;
cout<<"v1.3.2测试版:完善一些已知问题并开启开游戏关机功能(又名防沉迷)"<<endl;
cout<<"v1.3.2正式版:关闭防沉迷功能"<<endl;
cout<<"v1.3.3正式版:开启7月专版"<<endl;
cout<<"按任意键返回主页"<<endl;
cin>>l;
system("cls");
zhuye();
}
if (n==4){
system("cls");
db();
zhuye();
} if (n==5){
system("cls");
zhuanban();
zhuye();
}
if (n==6){
cout<<"你的存档码是:"<<lock(name)<<" "<<lock(my)<<" "<<jb<<" "<<endl;
cout<<"感谢游玩!";
return ;
}
}
void cd(){ //存档核实
system("cls");
cout<<"输入存档码"<<endl;
cin>>name>>my>>jb;
name=unlock(name);
my=unlock(my);
cout<<"请输入旧账号:" <<endl;
cin>>name2;
cout<<"请输入旧密钥:"<<endl;
cin>>my2;
if (name!=name2 || my!=my2){
cout<<"存档码与帐号不匹配,请重新输入"<<endl;
cd();
}
}
int main(){
cout<<"欢迎来到赚钱模拟器v1.3.3,后续正在开发中"<<endl;
cout<<"开启新生活=1"<<endl;
//cout<<"继续旧生活=2"<<endl;
int n;
cin>>n;
system("cls");
if (n==1){
jb=100;
cout<<"请输入账号(无中文):" <<endl;
cin>>name;
cout<<"请输入密钥(无中文):"<<endl;
cin>>my;
}
if (n==2){
cd();
}
zhuye();
return 0;
}
原创小游戏v1.3.3
最新推荐文章于 2024-09-02 23:29:10 发布