问题标题: 问答模拟器3.0 --存档来了!

0
0
已解决
黄中阳
黄中阳
初级光能
初级光能

没错,又更新了!

还加入了存档!

本次更新:

1.加入存档,可以存名字、豆子、经验、和等级,但帖子存不了,我试着存过帖子,但有很多BUG

2.加入了一个等级(共12个)

3.加入了称号

 

上代码!

 

 

#include<bits/stdc++.h>
#include<fstream>
#include<windows.h>
#ifndef _WINDOWS_
#define _WINDOWS_
#include <_mingw.h>
#include <sdkddkver.h>
#ifdef __OBJC__
#pragma push_macro("interface")
#undef interface
#define interface struct
#endif
#ifndef _INC_WINDOWS
#define _INC_WINDOWS
#if defined(RC_INVOKED) && !defined(NOWINRES)
#include <winresrc.h>
#else
#ifdef RC_INVOKED
#define NOATOM
#define NOGDI
#define NOGDICAPMASKS
#define NOMETAFILE
#define NOMINMAX
#define NOMSG
#define NOOPENFILE
#define NORASTEROPS
#define NOSCROLL
#define NOSOUND
#define NOSYSMETRICS
#define NOTEXTMETRIC
#define NOWH
#define NOCOMM
#define NOKANJI
#define NOCRYPT
#define NOMCX
#endif
#if defined(__x86_64) && \
  !(defined(_X86_) || defined(__i386__) || defined(_IA64_))
#if !defined(_AMD64_)
#define _AMD64_
#endif
#endif 
#if defined(__ia64__) && \
  !(defined(_X86_) || defined(__x86_64) || defined(_AMD64_))
#if !defined(_IA64_)
#define _IA64_
#endif
#endif 
#ifndef RC_INVOKED
#include <excpt.h>
#include <stdarg.h>
#endif
#include <windef.h>
#include <winbase.h>
#include <wingdi.h>
#include <winuser.h>
#include <winnls.h>
#include <wincon.h>
#include <winver.h>
#include <winreg.h>
#include <winnetwk.h>
#include <virtdisk.h>
#ifndef WIN32_LEAN_AND_MEAN
#include <cderr.h>
#include <dde.h>
#include <ddeml.h>
#include <dlgs.h>
#include <lzexpand.h>
#include <mmsystem.h>
#include <nb30.h>
#include <rpc.h>
#include <shellapi.h>
#include <winperf.h>
#if defined(__USE_W32_SOCKETS) || !defined(__CYGWIN__)
#include <winsock.h>
#endif
#ifndef NOCRYPT
#include <wincrypt.h>
#include <winefs.h>
#include <winscard.h>
#endif
#ifndef NOUSER
#ifndef NOGDI
#include <winspool.h>
#ifdef INC_OLE1
#include <ole.h>
#else
#include <ole2.h>
#endif
#include <commdlg.h>
#endif
#endif
#endif
#ifndef __CYGWIN__
#include <stralign.h>
#endif
#ifdef INC_OLE2
#include <ole2.h>
#endif
#ifndef NOSERVICE
#include <winsvc.h>
#endif
#ifndef NOMCX
#include <mcx.h>
#endif
#ifndef NOIME
#include <imm.h>
#endif
#endif
#endif
#ifdef __OBJC__
#pragma pop_macro("interface")
#endif
#endif
#include<conio.h> 
#include<iomanip> 
using namespace std;
bool qiandao; 
int dao=20,douzi,jingyan;
int hui[1000],chakan[1000];
string nei[1000],biao[1000],name;
int cnt; 
int shui;
void Ti(){
    SetConsoleTitle("闪耀问答3.0"); 
} 
int main(){
    Ti();
    fstream fs;
    fs.open("闪耀问答.txt", ios::in);
    if (!fs){
        cout<<"尊姓大名:";
        getline(cin,name);
        cout <<"\n创建存档中!"<<endl;
        ofstream fout("data.txt",ios::trunc);
        fout<<name<<endl<<"0"<<endl<<"0"<<endl<<"0"<<endl<<"0"<<endl;
        fout.close();
    }
    cout<<"读取中..."<<endl;
    ifstream infile("闪耀问答.txt");
    infile>>name>>douzi>>jingyan>>shui>>cnt;
    cout<<"读取成功"<<endl;
    ofstream outfile("闪耀问答.txt",ios::trunc);
    outfile<<name<<endl<<douzi<<endl<<jingyan<<endl<<shui<<endl<<cnt<<endl;
    system("pause");
    system("cls");
    cout<<"\t\t       这里是闪耀问答\n"; 
    cout<<"\t\tThere is the Lightning Wenda\n";
    Sleep(3000);
    cout<<"\t\t 若要此代码版权,请联系我们\n"; 
    Sleep(3000);
    system("cls");
    for(int i=1;i<=10;i++){
        cout<<"正在加载中";
        cout<<".";
        Sleep(100);
        cout<<".";
        Sleep(100);
        cout<<".";
        Sleep(100);
        system("cls");
    }
    system("cls");

    while(1){
        ofstream outfile("闪耀问答.txt",ios::trunc);
        outfile<<name<<endl<<douzi<<endl<<jingyan<<endl<<shui<<endl<<cnt<<endl;
        system("cls");
        cout<<"User name:"<<name<<endl;
        cout<<"_______________\n";
        cout<<"|我的闪币:"<<douzi<<"|\n";
        cout<<"______________\n"; 
        cout<<"|经验值:"<<jingyan<<"|\n";
        cout<<"________________\n"; 
        cout<<"|我的等级:";
        if(jingyan<=10){
            cout<<"修炼者"; 
        } 
        else if(jingyan<=15){
            cout<<"初级守护"; 
        }
        else if(jingyan<=22){
            cout<<"中级守护"; 
        }
        else if(jingyan<=30){
            cout<<"究极守护"; 
        }
        else if(jingyan<=40){
            cout<<"初级光能"; 
        }
        else if(jingyan<=50){
            cout<<"究极光能"; 
        }
        else if(jingyan<=60){
            cout<<"初级启示者"; 
        }
        else if(jingyan<=66){
            cout<<"神灵启示者"; 
        }
        else if(jingyan<=70){
            cout<<"能量之神"; 
        }
        else if(jingyan<=76){
            cout<<"光明缔造者"; 
        }
        else if(jingyan<=85){
            cout<<"巅峰缔造者"; 
        }
        else if(jingyan<=90){
            cout<<"缔造者守护神"; 
        }
        cout<<"|\n";
        cout<<"________________\n"; 
        cout<<"|我的称号:";
        if(shui<30) cout<<"暂无";
        else if(shui<50) cout<<"水王"; 
        else if(shui<60) cout<<"水圣"; 
        else if(shui<80) cout<<"水尊"; 
        else if(shui<90) cout<<"水神"; 
        cout<<"|\n";
        cout<<"________________\n";
        cout<<"0.酷町堂      1.我要提问      2.水闪币      ";
        if(!qiandao) cout<<"3.签到";
        cout<<"\n\n"; 
        for(int i=1;i<=cnt;i++){
            cout<<"贴"<<i<<"  |"<<biao[i]<<"|  "<<"打开扣"<<i+3<<"   查看:"<<chakan[i]<<"次"<<endl;
        }
        char c;
        c=getch();
        if(c=='0'){
            system("start https://ke.codingtang.com/");
        } 
        if(c>='4'){
            chakan[c-'0'-3]++;
            int shu=c-'0'-3;
            system("cls");
            cout<<biao[shu]<<endl;
            cout<<"____________________________________\n";
            for(int i=0;i<nei[shu].size();i++){
                if(nei[shu][i]=='$') cout<<endl;
                else cout<<nei[shu][i];
            }
            cout<<"\n\n\n0键退出     1键回答\n";
            char z;
            z=getch();
            if(z=='1'){
                string cmp="";
                cout<<"回答内容:\n"; 
                getline(cin,cmp);
                hui[shu]++;
                nei[shu]+="$$回答";
                nei[shu]+=(hui[shu]+'0');
                nei[shu]+="$   ";
                nei[shu]+=' '+cmp;
                nei[shu]+="$$";
                system("cls");
                cout<<"\n\t\t回答成功!";
                jingyan+=2;
                Sleep(1000);
                continue; 
            } 
            continue;
        }
        if(c=='2'){
            system("cls");
            int minn=1,maxn=5;
            srand((int)time(NULL));
            int a=minn+rand()%(maxn-minn+1);
            cout<<"水到了"<<a<<"个闪币\n";
            douzi+=a;
            shui++;
            if(shui>50) MessageBox(NULL,"累计水50次豆\n获得水王称号","提示",MB_OK);
            else if(shui>60) MessageBox(NULL,"累计水60次豆\n获得水圣称号","提示",MB_OK);
            else if(shui>80) MessageBox(NULL,"累计水80次豆\n获得水尊称号","提示",MB_OK);
            else if(shui>90) MessageBox(NULL,"累计水90次豆\n获得水神称号","提示",MB_OK);
            jingyan++;
            Sleep(3000); 
        } 
        if(c=='3'){
            system("cls");
            if(qiandao){
                cout<<"您已经签过了哦!"; 
                Sleep(2000);
                continue;
            }
            else{
                int minn=1,maxn=dao;
                srand((int)time(NULL));
                int a=minn+rand()%(maxn-minn+1);
                dao+=2;
                douzi+=a;
                qiandao=1;
                cout<<"恭喜获得"<<a<<"个闪币";
                Sleep(2000);
                continue; 
            }
        }
        else if(c=='1'){
            while(1){
                system("cls");
                int xuan=0;
                string timu,neirong;
                cout<<"悬赏金额:";
                cin>>xuan;
                cout<<"\n题目:"; 
                getline(cin,timu);
                getline(cin,timu);
                cout<<"\n内容(换行用$表示):\n";
                getline(cin,neirong);
                cout<<"\n是否发布:  是:1     否:0\n";
                int x;
                cin>>x;
                if(x==1){
                    if(xuan<10){
                        MessageBox(NULL,"悬赏金额不能低于10","提示",MB_OK);
                        continue;
                    }
                    else if(xuan>douzi){
                        MessageBox(NULL,"闪币不够","提示",MB_OK);
                        continue;
                    }
                    cout<<"发布成功!";
                    douzi-=xuan; 
                    jingyan+=6;
                    cnt++;
                    nei[cnt]=neirong;
                    biao[cnt]=timu;
                    Sleep(1000); 
                    break;
                }
                break;
            }
            continue;
        }
    }
    outfile.close();
    return 0;
}

 

有BUG敬请反馈

目前问答模拟器属于Lightning

如有工作室想要

请回答申请


1
已采纳
沈峻宇
沈峻宇
资深天翼
资深天翼

常用不良词汇可以和谐掉

特判比如:s b,神 经 病,脑 can

沈峻宇在2021-08-30 14:44:12追加了内容

if(输入的字符串含有非法字符或不良词语){

    cout<<"请**输入语句,不可带有非法字符或不良词语,请重头输入";

    cnt++

    cnt==3 封号或禁言

}

封号可以用结束程序删除存档,禁言就是flag=false,发言或问问题前判断即可

判断过程参考题库:酷町猫的恶作剧的部分代码

 

沈峻宇在2021-08-30 14:45:27追加了内容

我不是不会,懒得敲

0
王文博
王文博
缔造者之神
缔造者之神

你退出金光工作室了吗?我还没有正式退出,宫成不知道哪里去了

0
0
0
刘乐宸
刘乐宸
新手天翼
新手天翼

酷町平台的作品不好做,但如果你把这个上了平台,直接火爆

0
0
0
0
0
0
我要回答