问题标题: 问答模拟器1.5

0
0
已解决
黄中阳
黄中阳
初级光能
初级光能
#include<bits/stdc++.h>
#include<windows.h>
#include<conio.h> 
#include<iomanip> 
using namespace std;
bool qiandao; 
int dao=20,douzi;
int hui[1000];
string nei[1000],biao[1000];
int cnt; 
void Ti(){
    SetConsoleTitle("问答1.0");   
} 
int main(){
    Ti();
    cout<<"\t\t     这里是闪耀问答\n"; 
    cout<<"\t\tThis is the Lightning Wenda";
    Sleep(3000);
    system("cls");
    for(int i=1;i<=10;i++){
        cout<<"正在加载中";
        cout<<".";
        Sleep(100);
        cout<<".";
        Sleep(100);
        cout<<".";
        Sleep(100);
        system("cls");
    }
    while(1){
        system("cls");
        cout<<"________________\n";
        cout<<"|我的酷町豆:"<<douzi<<"|\n";
        cout<<"________________\n"; 
        cout<<"1.我要提问      2.赚豆豆      ";
        if(!qiandao) cout<<"3.签到";
        cout<<"\n\n"; 
        for(int i=1;i<=cnt;i++){
            cout<<"贴"<<i<<"  |"<<biao[i]<<"|  "<<"打开扣"<<i+3<<endl<<endl;
        }
        char c;
        c=getch();
        if(c>='4'){
            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);
                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回答成功!";
                Sleep(1000);
            } 
            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;
            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; 
                    cnt++;
                    nei[cnt]=neirong;
                    biao[cnt]=timu;
                    Sleep(1000); 
                    break;
                }
                else break;
            }
            continue;
        }
    }
    return 0;
}

加入了回答功能!(有点low)

我还是不会存档!

再说,存了怎么读取?


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

我就一个建议,闪耀问答用闪耀豆,别用酷町豆了

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

不错!帮你顶个帖子

0
0
郑思予
郑思予
新手光能
新手光能

我会存档和读取(自豪),如果你要的话QQ私聊。ヾ(•ω•`)o

0
0
我要回答