c++用codeblocks手动创建一个exe小程序“题目-答案出题系统”

第一部分:案例分析

我们基于一个“题目-答案出题系统”,勾选不同的考核题目,每一次弹出一道题:

功能如下:

1. 英文简历背诵

2. 英文基础提问背诵

3. 科研内部技术名词

4. 算法课程

5. 计算机网络

6. 操作系统

7. 计算机组成原理

8. 数据结构

进入之后我们点击其中一个功能,以“英文简历背诵”为例,选择“随机出题”和“顺序出题”两类,我们输入1表示随机出题(如下):

我们再输入1表示显示问题的答案(如下):

接着,输入1则会开始下一个问题的提问,输入2则会跳转到最开始的功能选择界面。

第二部分:案例代码实现

#include <iostream>
using namespace std;
#include<vector>
#include <ctime>   // 包含时间库,用于生成种子

int main();
int show_functions();
void choose_function(int choice);
void function1();//英文简历背诵
void function2();//英文基础提问背诵
void function3();//科研内部技术名词
void function4();//算法课程
void function5();//计算机网络
void function6();//操作系统
void function7();//计算机组成原理
void function8();//数据结构
void function9();//Exit

int function1_random_index();//功能1随机index
string input_question1(int index);//功能1问题
string input_answer1(int index);//功能1答案
int function2_random_index();//功能2随机index
string input_question2(int index);//功能2问题
string input_answer2(int index);//功能2答案
int function3_random_index();//功能3随机index
string input_question3(int index);//功能3问题
string input_answer3(int index);//功能3答案
int function4_random_index();//功能4随机index
string input_question4(int index);//功能4问题
string input_answer4(int index);//功能4答案
int function5_random_index();//功能5随机index
string input_question5(int index);//功能5问题
string input_answer5(int index);//功能5答案
int function6_random_index();//功能6随机index
string input_question6(int index);//功能6问题
string input_answer6(int index);//功能6答案
int function7_random_index();//功能7随机index
string input_question7(int index);//功能7问题
string input_answer7(int index);//功能7答案
int function8_random_index();//功能8随机index
string input_question8(int index);//功能8问题
string input_answer8(int index);//功能8答案

bool control();//控制下一条是否继续展现
int show_functions() {
    cout << "====================================" <<endl;
    cout << "欢迎来到周俊超预推免背诵系统!" <<endl;
    cout << "====================================" <<endl;
    cout << "功能汇总如下:" <<endl;
    cout << "====================================" <<endl;
    cout << "|  1. 英文简历背诵~~~~~~~~~~~~~~~~~|" <<endl;
    cout << "|  2. 英文基础提问背诵~~~~~~~~~~~~~|" <<endl;
    cout << "|  3. 科研内部技术名词~~~~~~~~~~~~~|" <<endl;
    cout << "|  4. 算法课程~~~~~~~~~~~~~~~~~~~~~|" <<endl;
    cout << "|  5. 计算机网络~~~~~~~~~~~~~~~~~~~|" <<endl;
    cout << "|  6. 操作系统~~~~~~~~~~~~~~~~~~~~~|"<<endl;
    cout << "|  7. 计算机组成原理~~~~~~~~~~~~~~~|" <<endl;
    cout << "|  8. 数据结构~~~~~~~~~~~~~~~~~~~~~|" <<endl;
    cout << "|  9. Exit~~~~~~~~~~~~~~~~~~~~~~~~~|" <<endl;
    cout << "====================================" <<endl;
    cout << "请输入您的选择: ";
    int choice;
    cin>>choice;
    return choice;
}
void function1(){
    cout<<"输入1选择随机,输入2选择顺序,请输入:"<<endl;
    int input_choice;
    cin>>input_choice;
    if(input_choice==1)
    {
        bool flag=true;
        while(flag)
        {
            int random_index=function1_random_index();
            string random_question=input_question1(random_index);
            string random_answer=input_answer1(random_index);
            cout<<random_question<<endl;

            cout<<"输入1显示答案:"<<endl;
            int temp;
            cin>>temp;
            if(temp==1)
            {
                cout<<random_answer<<endl;
            }

            bool flag=control();//返回true代表继续下一条,返回false代表终止,我们自动返回到功能选择界面
            if(flag==false)
            {
                system("cls");  // 清屏操作
                main();
                break;
            }
        }

    }
    else if(input_choice==2)
    {
        for(int i=0;i<8;i++)
        {
            int index=i;
            string question=input_question1(index);
            string answer=input_answer1(index);
            cout<<question<<endl;

            cout<<"输入1显示答案:"<<endl;
            int temp;
            cin>>temp;
            if(temp==1)
            {
               cout<<answer<<endl;
            }

            bool flag=control();//返回true代表继续下一条,返回false代表终止,我们自动返回到功能选择界面
            if(flag==false)
            {
                system("cls");  // 清屏操作
                main();
                break;
            }
        }
    }

}
void function2(){
    cout<<"输入1选择随机,输入2选择顺序,请输入:"<<endl;
    int input_choice;
    cin>>input_choice;
    if(input_choice==1)
    {
        bool flag=true;
        while(flag)
        {
            int random_index=function2_random_index();
            string random_question=input_question2(random_index);
            string random_answer=input_answer2(random_index);
            cout<<random_question<<endl;

            cout<<"输入1显示答案:"<<endl;
            int temp;
            cin>>temp;
            if(temp==1)
            {
                cout<<random_answer<<endl;
            }
            bool flag=control();//返回true代表继续下一条,返回false代表终止,我们自动返回到功能选择界面
            if(flag==false)
            {
                system("cls");  // 清屏操作
                main();
                break;
            }
        }

    }
    else if(input_choice==2)
    {
        for(int i=0;i<8;i++)
        {
            int index=i;
            string question=input_question2(index);
            string answer=input_answer2(index);
            cout<<question<<endl;
            cout<<"输入1显示答案:"<<endl;
            int temp;
            cin>>temp;
            if(temp==1)
            {
               cout<<answer<<endl;
            }
            bool flag=control();//返回true代表继续下一条,返回false代表终止,我们自动返回到功能选择界面
            if(flag==false)
            {
                system("cls");  // 清屏操作
                main();
                break;
            }
        }
    }

}
void function3(){
    cout<<"输入1选择随机,输入2选择顺序,请输入:"<<endl;
    int input_choice;
    cin>>input_choice;
    if(input_choice==1)
    {
        bool flag=true;
        while(flag)
        {
            int random_index=function3_random_index();
            string random_question=input_question3(random_index);
            string random_answer=input_answer3(random_index);
            cout<<random_question<<endl;

            cout<<"输入1显示答案:"<<endl;
            int temp;
            cin>>temp;
            if(temp==1)
            {
                cout<<random_answer<<endl;
            }

            bool flag=control();//返回true代表继续下一条,返回false代表终止,我们自动返回到功能选择界面
            if(flag==false)
            {
                system("cls");  // 清屏操作
                main();
                break;
            }
        }

    }
    else if(input_choice==2)
    {
        for(int i=0;i<8;i++)
        {
            int index=i;
            string question=input_question3(index);
            string answer=input_answer3(index);
            cout<<question<<endl;
            cout<<"输入1显示答案:"<<endl;
            int temp;
            cin>>temp;
            if(temp==1)
            {
               cout<<answer<<endl;
            }
            bool flag=control();//返回true代表继续下一条,返回false代表终止,我们自动返回到功能选择界面
            if(flag==false)
            {
                system("cls");  // 清屏操作
                main();
                break;
            }
        }
    }

}
void function4(){
    cout<<"输入1选择随机,输入2选择顺序,请输入:"<<endl;
    int input_choice;
    cin>>input_choice;
    if(input_choice==1)
    {
        bool flag=true;
        while(flag)
        {
            int random_index=function4_random_index();
            string random_question=input_question4(random_index);
            string random_answer=input_answer4(random_index);
            cout<<random_question<<endl;
            cout<<"输入1显示答案:"<<endl;
            int temp;
            cin>>temp;
            if(temp==1)
            {
               cout<<random_answer<<endl;
            }
            bool flag=control();//返回true代表继续下一条,返回false代表终止,我们自动返回到功能选择界面
            if(flag==false)
            {
                system("cls");  // 清屏操作
                main();
                break;
            }
        }

    }
    else if(input_choice==2)
    {
        for(int i=0;i<8;i++)
        {
            int index=i;
            string question=input_question4(index);
            string answer=input_answer4(index);
            cout<<question<<endl;
            cout<<"输入1显示答案:"<<endl;
            int temp;
            cin>>temp;
            if(temp==1)
            {
               cout<<answer<<endl;
            }
            bool flag=control();//返回true代表继续下一条,返回false代表终止,我们自动返回到功能选择界面
            if(flag==false)
            {
                system("cls");  // 清屏操作
                main();
                break;
            }
        }
    }

}
void function5(){
    cout<<"输入1选择随机,输入2选择顺序,请输入:"<<endl;
    int input_choice;
    cin>>input_choice;
    if(input_choice==1)
    {
        bool flag=true;
        while(flag)
        {
            int random_index=function5_random_index();
            string random_question=input_question5(random_index);
            string random_answer=input_answer5(random_index);
            cout<<random_question<<endl;
            cout<<"输入1显示答案:"<<endl;
            int temp;
            cin>>temp;
            if(temp==1)
            {
               cout<<random_answer<<endl;
            }
            bool flag=control();//返回true代表继续下一条,返回false代表终止,我们自动返回到功能选择界面
            if(flag==false)
            {
                system("cls");  // 清屏操作
                main();
                break;
            }
        }

    }
    else if(input_choice==2)
    {
        for(int i=0;i<8;i++)
        {
            int index=i;
            string question=input_question5(index);
            string answer=input_answer5(index);
            cout<<question<<endl;
            cout<<"输入1显示答案:"<<endl;
            int temp;
            cin>>temp;
            if(temp==1)
            {
               cout<<answer<<endl;
            }
            bool flag=control();//返回true代表继续下一条,返回false代表终止,我们自动返回到功能选择界面
            if(flag==false)
            {
                system("cls");  // 清屏操作
                main();
                break;
            }
        }
    }

}
void function6(){
    cout<<"输入1选择随机,输入2选择顺序,请输入:"<<endl;
    int input_choice;
    cin>>input_choice;
    if(input_choice==1)
    {
        bool flag=true;
        while(flag)
        {
            int random_index=function6_random_index();
            string random_question=input_question6(random_index);
            string random_answer=input_answer6(random_index);
            cout<<random_question<<endl;
            cout<<"输入1显示答案:"<<endl;
            int temp;
            cin>>temp;
            if(temp==1)
            {
               cout<<random_answer<<endl;
            }
            bool flag=control();//返回true代表继续下一条,返回false代表终止,我们自动返回到功能选择界面
            if(flag==false)
            {
                system("cls");  // 清屏操作
                main();
                break;
            }
        }

    }
    else if(input_choice==2)
    {
        for(int i=0;i<8;i++)
        {
            int index=i;
            string question=input_question6(index);
            string answer=input_answer6(index);
            cout<<question<<endl;
            cout<<"输入1显示答案:"<<endl;
            int temp;
            cin>>temp;
            if(temp==1)
            {
               cout<<answer<<endl;
            }
            bool flag=control();//返回true代表继续下一条,返回false代表终止,我们自动返回到功能选择界面
            if(flag==false)
            {
                system("cls");  // 清屏操作
                main();
                break;
            }
        }
    }

}
void function7(){
    cout<<"输入1选择随机,输入2选择顺序,请输入:"<<endl;
    int input_choice;
    cin>>input_choice;
    if(input_choice==1)
    {
        bool flag=true;
        while(flag)
        {
            int random_index=function7_random_index();
            string random_question=input_question7(random_index);
            string random_answer=input_answer7(random_index);
            cout<<random_question<<endl;
            cout<<"输入1显示答案:"<<endl;
            int temp;
            cin>>temp;
            if(temp==1)
            {
               cout<<random_answer<<endl;
            }
            bool flag=control();//返回true代表继续下一条,返回false代表终止,我们自动返回到功能选择界面
            if(flag==false)
            {
                system("cls");  // 清屏操作
                main();
                break;
            }
        }

    }
    else if(input_choice==2)
    {
        for(int i=0;i<8;i++)
        {
            int index=i;
            string question=input_question7(index);
            string answer=input_answer7(index);
            cout<<question<<endl;
            cout<<"输入1显示答案:"<<endl;
            int temp;
            cin>>temp;
            if(temp==1)
            {
               cout<<answer<<endl;
            }
            bool flag=control();//返回true代表继续下一条,返回false代表终止,我们自动返回到功能选择界面
            if(flag==false)
            {
                system("cls");  // 清屏操作
                main();
                break;
            }
        }
    }

}
void function8(){
    cout<<"输入1选择随机,输入2选择顺序,请输入:"<<endl;
    int input_choice;
    cin>>input_choice;
    if(input_choice==1)
    {
        bool flag=true;
        while(flag)
        {
            int random_index=function8_random_index();
            string random_question=input_question8(random_index);
            string random_answer=input_answer8(random_index);
            cout<<random_question<<endl;
            cout<<"输入1显示答案:"<<endl;
            int temp;
            cin>>temp;
            if(temp==1)
            {
               cout<<random_answer<<endl;
            }
            bool flag=control();//返回true代表继续下一条,返回false代表终止,我们自动返回到功能选择界面
            if(flag==false)
            {
                system("cls");  // 清屏操作
                main();
                break;
            }
        }

    }
    else if(input_choice==2)
    {
        for(int i=0;i<8;i++)
        {
            int index=i;
            string question=input_question8(index);
            string answer=input_answer8(index);
            cout<<question<<endl;
            cout<<"输入1显示答案:"<<endl;
            int temp;
            cin>>temp;
            if(temp==1)
            {
               cout<<answer<<endl;
            }
            bool flag=control();//返回true代表继续下一条,返回false代表终止,我们自动返回到功能选择界面
            if(flag==false)
            {
                system("cls");  // 清屏操作
                main();
                break;
            }
        }
    }
}
void choose_function(int choice){
    switch(choice)
    {
        case 1:
        {
            system("cls");  // 清屏操作
            cout<<"进入《英文简历背诵》环节"<<endl;
            function1();
            break;
        }
        case 2:
        {
           system("cls");  // 清屏操作
            cout<<"进入《英文基础提问背诵》环节"<<endl;
            function2();
            break;
        }
        case 3:
        {
           system("cls");  // 清屏操作
            cout<<"进入《科研内部技术名词》环节"<<endl;
            function3();
            break;
        }
        case 4:
        {
           system("cls");  // 清屏操作
            cout<<"进入《算法课程》环节"<<endl;
            function4();
            break;
        }
        case 5:
        {
           system("cls");  // 清屏操作
            cout<<"进入《计算机网络》环节"<<endl;
            function5();
            break;
        }
        case 6:
        {
           system("cls");  // 清屏操作
            cout<<"进入《操作系统》环节"<<endl;
            function6();
            break;
        }
        case 7:
        {
             system("cls");  // 清屏操作
            cout<<"进入《计算机组成原理》环节"<<endl;
            function7();
            break;
        }
        case 8:
        {
             system("cls");  // 清屏操作
            cout<<"进入《数据结构》环节"<<endl;
            function8();
            break;
        }
        case 9:
        {
            system("cls");  // 清屏操作
            cout<<"退出程序"<<endl;
            break;
        }
    }
}
//功能1子模块
int function1_random_index(){
    srand((int)time(0));  // 产生随机种子  把0换成NULL也行
    int result= rand()%8;
    return result;
}
string input_question1(int index){
    vector<string>question=
    {
        "问题1:1min第一段自我介绍",
        "问题2:1min第二段自我介绍",
        "问题3:1min第三段自我介绍",
        "问题4:第一部分:专业成绩回答",
        "问题5:第二部分:科研经历回答",
        "问题6:第三部分:实习经历回答",
        "问题7:第四部分:获奖证书回答",
        "问题8:第五部分:未来规划回答"

    };
    string result=question[index];
    return result;
}
string input_answer1(int index){
    vector<string>answer=
    {
        "答案1:Hi,my name is zhoujunchao;First of all,I am doing computer science at henan university of technology,and generally,"
        "I am the kind of person who gives people the impression of being open-minded and passionate.well,what’s special in me is that I am a well-rounded guy.",
        "答案2:Secondly,I am also a goal oriented person.I have a clear blueprint of my study、research and internship.I spent almost 19 years to study what’s my real passion is."
        "Actually,I switch my major from materials to computer.And actually, I found out what i am really into. And during the past three years,I have participated in three research projects led by my tutor,"
        "and I decided to do more research during my master’s degree in machine learning.",
        "答案3:Lastly,i spent almost three years to train myself into a programmer,and my long term goal is to become a professional java engineer,i figure out this goal since my last internship in henan hualan technology company,"
        "the mission is fit in well with my sense of worth,so please feel so free to ask me any question.",
        "答案4:Among 252 students in my major,i ranked first in my comprehensive evaluation,and i have passed the CET-4,CET-6 and IELTS 6.0",
        "答案5:(1)As the first author,I published a paper in FPS on the relationship between sex ratio and ecosystem stability,using the volterra equation,logistic regression,normalization and simulated annealing to acquire the optimal gender ratio."
        "(2)In my spare time,I participated in a research project led by my tutor in machine learning,we studied a rumor detection paper and used the mask to reduce noise edge to improve prediction accuracy."
        "(3)Besides,I used the THZ technology to acquire rapid non-destructive detection of wheat moisture.I also utilize springboot and vue2 to build the platform.now,we are applying for two invention patents and three software copyrights",
        "答案6:Last year,I worked as a Java engineer in henan hualan technology company,built a library management system and completed nearly 4000 lines of code. We also used several technology to improve this project ,"
        "including/such as:security management,filters,interceptors,jwt token ,exception handling,the mixed cache based Redis and simple.",
        "答案7:(1)the first is math,I have won four math competitions ,including a silver medal in Olympics math competition two national second price in Data Statistics and Analysis competition and  three provincial first prize in CMC and MCM"
        "(2)The second is English,I have won the national second prize organized by fltrp and baicizhan and two provincial first and second prize in NECCS.in my spare time,i also acquired the advanced translation certificate"
        "(3)The third is programme , i won two provincial first and second prize in programming competition to improve my IT skills,and I have passed the internet operator intermediate certificate",
        "答案8:(1)In the first year, it's important to learn basic knowledge of my master's major, and I've decided to improve my English level."
        "(2)In the second year, I plan to begin writing my thesis and to join my advisor's research group."
        "(3)In the third year, I will update my resume and start my job search."
        "I am eager to become a member of your esteemed school to learn more advanced knowledge and make contributions to the society. "
    };
     string result=answer[index];
     return result;
}
//功能2子模块
int function2_random_index(){
    srand((int)time(0));  // 产生随机种子  把0换成NULL也行
    int result= rand()%14+33;
    return result;
}
string input_question2(int index){
    vector<string>question=
    {
        "基本问题问题1: Where do you come from?",
        "基本问题问题2: What kind of landscape surrounds your hometown?",
        "基本问题问题3: Can you please describe your hometown?",
        "基本问题问题4: Tell me something about the customs of your hometown。",
        "基本问题问题5: Could you tell me something about your family?",
        "基本问题问题6: What does friendship mean to you and what kind of people do you make friends with?",
        "基本问题问题7: Can you describe about your weakness?",
        "基本问题问题8: What’s your greatest strength?",
        "基本问题问题9: What kind of person are you?",
        "基本问题问题10: What are your spare time interests?",
        "基本问题问题11: Where have you been traveling to? Which place interested you most?",
        "基本问题问题12: Can you describe one of your favorite books?",
        "基本问题问题13: Can you describe one of your favorite movies?",
        "基本问题问题14: Can you describe your favorite idol or celebrity? Why?",
        "梦想问题1:What kind of differences in the system of higher education between China and other countries?",
        "梦想问题2:Do you think you will be able to cope with English-demands of your intended study program?",
        "梦想问题3:What difficulties do you think you'll encounter in your studies?",
        "梦想问题4:If there were an opportunity of studying abroad, what would you do?",
        "梦想问题5:Should you study more theory or do more practice? Give your reasons, please.",
        "梦想问题6:What do you intend to do after you finish studying?",
        "梦想问题7:How do you afford your tuition?",
        "梦想问题8:Does your family support your decision on studying? What help do they offer?",
        "梦想问题9:Can you describe your future plan after graduation?",
        "梦想问题10:What’s your recent goal?",
        "梦想问题11:How do you handle your failure?",
        "梦想问题12:If you failed this time, what will you do in the near future?",
        "梦想问题13:What has been your greatest accomplishment?",
        "梦想问题14:What kinds of opportunities are you looking for?",
        "梦想问题15:Why do you think people like to go abroad to receive an education?",
        "梦想问题16:What will you do for a living?",
        "梦想问题17:What are your job prospects?",
        "梦想问题18:What social responsibilities should a post-graduate take?",
        "梦想问题19:Which kind of professor do you like best?",
        "梦想问题20:How do you like your major?",
        "梦想问题21:What qualifications have you obtained?",
        "梦想问题22:What impressed you most when you were at university?",
        "梦想问题23:Can you give me a summary of your four years in university?",
        "梦想问题24:Do you think the subjects you are studying today are relevant to contemporary society? Why?",
        "梦想问题25:What’s your strength on your major?",
        "梦想问题26:Can you please describe one of your courses?",
        "梦想问题27:Why do you choose this university?",
        "梦想问题28:If you had the opportunity to change your subject, what would you do with it?",
        "梦想问题29:Can you describe your original university?",
        "梦想问题30:Can you describe one project you have done recently?",
        "梦想问题31:Why did you transfer your major?",
        "梦想问题32:What’s the importance of learning a new language?",
        "梦想问题33:Will you study a second foreign language, why?"

    };
    string result=question[index];
    return result;
}
string input_answer2(int index){
    vector<string>answer=
    {
        "基本问题答案1:I come from Henan Zhoukou.",
        "基本问题答案2:I live in the countryside, where there is a beautiful environment surrounded by wheat and corn fields. The neighbors are friendly, and living there makes me feel happy.",
        "基本问题答案3:I live in the countryside, where there is a beautiful environment surrounded by wheat and corn fields. The neighbors are friendly, and living there makes me feel happy.",
        "基本问题答案4:Every March, many people in my hometown attend temple fairs, where they pray for a good harvest of crops and the safety of their families in the new year.",
        "基本问题答案5:My father is a doctor who saves lives. He has participated in many epidemic prevention and control efforts. He is my idol.",
        "基本问题答案6:Friendship means trust, respect, and support. I want to make friends with people who are open-minded and honest.",
        "基本问题答案7:I'm not very good at handling interpersonal relationships and my speaking skills are also not strong, these are my weaknesses.",
        "基本问题答案8:I am sincere to my friends and good at thinking about problems, which are my strengths and drive me to become even better.",
        "基本问题答案9:I am sincere to my friends and good at thinking about problems, which are my strengths and drive me to become even better.",
        "基本问题答案10:In my spare time, I tend to practice handwriting and engage in physical exercise to improve myself.",
        "基本问题答案11:In my spare time, I often travel to Zhengzhou Park, where there is a beautiful lake full of fish. The golden leaves and beautiful flowers can relax me and cheer me up.",
        "基本问题答案12:My favorite book is 'Against the God,' which describes a boy who keeps overcoming difficulties and breaking through himself to obtain great achievements.",
        "基本问题答案13:My favorite movie is 'Against the God,' which describes a boy who keeps overcoming difficulties and breaking through himself to obtain great achievements.",
        "基本问题答案14:My father is a doctor who saves lives. He has participated in many epidemic prevention and control efforts. He is my idol.",
        "梦想答案1:China's higher education system heavily relies on the GaoKao for admission. However, other countries tend to have diverse assessments. Secondly, in China, everyone has the opportunity to receive education, but it's not the case in other countries.",
        "梦想答案2:Yes, because I can understand basic academic English expressions. Besides, when I encounter some English problems, I can improve myself through learning.",
        "梦想答案3:The biggest challenge is seeking innovation in unknown fields. Besides, it's also important to keep a balance between study, love, and work.",
        "梦想答案4:I'll try, because it's a great opportunity for me to learn more advanced knowledge and make contributions to society.",
        "梦想答案5:I will choose practice. I believe genuine knowledge comes from practice. Because practice can help us strengthen what we have learned and discover more problems, thereby further improving ourselves.",
        "梦想答案6:My long term goal is to become a professional Java engineer. Programming is interesting and challenging, besides, it can also provide me with a great salary by completing projects.",
        "梦想答案7:There are many ways. For example, projects, scholarships, family education, and internships can provide me with a great salary.",
        "梦想答案8:Yes, my parents support me to study. They can provide me with financial support. Besides, when I have problems, I often talk to them.",
        "梦想答案9:My long term goal is to become a professional Java engineer. Programming is interesting and challenging, besides, it can also provide me with a great salary by completing projects.",
        "梦想答案10:My recent goal is to obtain a postgraduate qualification. During my senior year, I want to learn the basic knowledge of scientific research and improve my programming and English levels.",
        "梦想答案11:When I fail, I will analyze the reason and draw lessons from it. Besides, I think failure can make me better by enhancing my experience.",
        "梦想答案12:When I fail, I will analyze the reason and draw lessons from it. Besides, I think failure can make me better by enhancing my experience.",
        "梦想答案13:I obtained the postgraduate qualification through three years' hard work, which is my greatest achievement.",
        "梦想答案14:I am looking for the opportunity to go to a famous school to learn more advanced knowledge and make contributions to society.",
        "梦想答案15:In my opinion, the main reason is that they want to learn more advanced knowledge to make contributions to society and to get a higher salary.",
        "梦想答案16:My long term goal is to become a professional Java engineer. Programming is interesting and challenging, besides, it can also provide me with a great salary by completing projects.",
        "梦想答案17:My long term goal is to become a professional Java engineer. Programming is interesting and challenging, besides, it can also provide me with a great salary by completing projects.",
        "梦想答案18:We have a responsibility and obligation to use our professional knowledge to solve social problems and make contributions to the progress of national science and technology.",
        "梦想答案19:I like those professors who are innovative, responsible, and caring for students.",
        "梦想答案20:Actually, I switched my major from Materials to Computer Science. Computer is interesting and challenging, which can provide me with opportunities to grow and innovate.",
        "梦想答案21:I have acquired an advanced translation certificate and passed the internet operator intermediate certificate.",
        "梦想答案22:In college, I realized the importance of independent learning and thinking. We need to plan and enrich our lives, which impressed me the most.",
        "梦想答案23:I will introduce my achievements from three aspects. Firstly, I switched my major from materials to computer. Secondly, I obtained the postgraduate qualification. Thirdly, I made friends with people who are like-minded.",
        "梦想答案24:Yes, for example, machine learning laid a foundation for my scientific research. Besides, Java Web and JEE can help me complete enterprise projects.",
        "梦想答案25:I have a better foundation in theoretical knowledge as well as practical skills. Besides, I am sincere to my friends and good at thinking about problems, which are my strengths and drive me to become even better.",
        "梦想答案26:Yes, the JavaWeb and JEE courses are useful and interesting. I learned how to use SpringBoot and Vue2 to build the platform. Besides, I have learned many useful technologies, including security management, filter, interceptor, exception handling, JWT token, and mixed cache.",
        "梦想答案27:Your honorable school has a famous reputation in my field of study. I believe I can learn more advanced knowledge to improve my IT levels and make contributions to society.",
        "梦想答案28:If I can change my major, I will study the intersection subject of computer science. Because it's interesting and challenging to apply computer technology to other disciplines.",
        "梦想答案29:The meals are cheap and delicious in my university. Besides, there is a beautiful lake full of fish. The golden leaves and beautiful flowers can relax me and cheer me up.",
        "梦想答案30:Last year, I worked as a Java engineer in Henan Hualan Technology Company, built a library management system, and completed nearly 4000 lines of code. We also used several technologies to improve this project, such as security management, filters, interceptors, JWT token, exception handling, the mixed cache based on Redis and simple.",
        "梦想答案31:Actually, I switched my major from Materials to Computer Science. Computer is interesting and challenging, which can provide me with opportunities to grow and innovate.",
        "梦想答案32:Firstly, a new language can help me to read more books and broaden my horizons. Besides, language learning enhances cognitive abilities, such as problem solving and critical thinking.",
        "梦想答案33:Firstly, a new language can help me to read more books and broaden my horizons. Besides, language learning enhances cognitive abilities, such as problem solving and critical thinking."

    };
     string result=answer[index];
     return result;
}
//功能3子模块
int function3_random_index(){
    srand((int)time(0));  // 产生随机种子  把0换成NULL也行
    int result= rand()%6;
    return result;
}
string input_question3(int index){
    vector<string>question1=
    {
        "问题1. 输入",
        "问题2. 技术一(bert)",
        "问题3. 技术二(边参数)",
        "问题4. 技术三(掩码)",
        "问题5. 技术四(训练)",
        "问题6. 输出"
    };
    string result=question1[index];
    return result;
}
string input_answer3(int index){
    vector<string>answer1=
    {
        "答案1:\n①点:新闻\n②边:新闻的转发次数\n③图:点和边组成",
        "答案2:\n特点如下:\n①自然语言处理\n②基于transformer架构\n③无监督\n④将输入文本转化为矩阵表示的形式",
        "答案3:\n①边的度数(无向图)\n②边的共参与度(两个节点之间关系强度的划分)",
        "答案4:\n①使用多层感知机将上一步得到的共参与度和邻接矩阵相结合\n②再使用softmax归一化得到范围为[0,1]",
        "答案5:\n①前向传播,有两个图卷积层(第一个用来初步提取特征,捕捉一阶邻居关系)(第二个用来聚合更广泛的邻居信息,也就是邻居的邻居)\n②计算交叉熵损失函数\n③反向传播,使用MLP进行边权重调整",
        "答案6:\n输出为4种评价指标,分别是:\n①准确率(预测正确的概率)\n②精确率(正样本中预测正确的概率)\n③召回率(结果预测为正的概率)\n④F1分数"
    };
     string result=answer1[index];
     return result;
}
//功能4子模块
int function4_random_index(){
    srand((int)time(0));  // 产生随机种子  把0换成NULL也行
    int result= rand()%6;
    return result;
}
string input_question4(int index){
    vector<string>question=
    {
        "问题1:冒泡排序的①时间复杂度②空间复杂度③稳定性",
        "问题2:选择排序的①时间复杂度②空间复杂度③稳定性",
        "问题3:插入排序的①时间复杂度②空间复杂度③稳定性",
        "问题4:堆排序的①时间复杂度②空间复杂度③稳定性",
        "问题5:归并排序的①时间复杂度②空间复杂度③稳定性",
        "问题6:快速排序的①时间复杂度②空间复杂度③稳定性"
    };
    string result=question[index];
    return result;
}
string input_answer4(int index){
    vector<string>answer=
    {
        "答案1:\n时间复杂度:最优和最坏的时间复杂度都是O(n^2)\n空间复杂度:O(1)\n稳定性:稳定",
        "答案2:\n时间复杂度:最优和最坏的时间复杂度都是O(n^2)\n空间复杂度:O(1)\n稳定性:不稳定",
        "答案3:\n时间复杂度:最优时间复杂度为O(n),最坏的时间复杂度为O(n^2),平均时间复杂度为O(n^2)\n空间复杂度:O(1)\n稳定性:稳定",
        "答案4:\n时间复杂度:最好、最坏、平均时间复杂度都是O(nlogn)\n空间复杂度:O(1)\n稳定性:不稳定",
        "答案5:\n时间复杂度:时间复杂度O(nlogn)\n空间复杂度:O(n)\n稳定性:稳定",
        "答案6:\n时间复杂度:最快时间复杂度O(nlogn),最慢的时间复杂度O(n^2)\n空间复杂度:O(logn)\n稳定性:不稳定"
    };
     string result=answer[index];
     return result;
}
//功能5子模块
int function5_random_index(){
    srand((int)time(0));  // 产生随机种子  把0换成NULL也行
    int result= rand()%42;
    return result;
}
string input_question5(int index){
    vector<string>question=
    {
        "问题1:计算机网络的组成",
        "问题2:计算机网络的性能指标",
        "问题3:三种交换方式(第一种:电路交换)",
        "问题4:三种交换方式(第二种:报文交换)",
        "问题5:三种交换方式(第三种:分组交换)",
        "问题6:五层体系结构",
        "问题7:曼彻斯特编码",
        "问题8:码元",
        "问题9:香农公式",
        "问题10:奈氏准则",
        "问题11:信道复用技术",
        "问题12:数据链路层的三个基本问题",
        "问题13:集线器和交换机的区别",
        "问题14:交换机和路由器的区别",
        "问题15:CSMA/CD协议",
        "问题16:ppp协议",
        "问题17:vlan虚拟局域网",
        "问题18:ARP地址解析协议",
        "问题19:网际控制报文协议",
        "问题20:ipv4到ipv6的过渡",
        "问题21:互联网的路由选择协议",
        "问题22:RIP协议",
        "问题23:OSPF协议",
        "问题24:BGP协议",
        "问题25:IP多播",
        "问题26:IGMP协议",
        "问题27:网络地址转换NAT协议",
        "问题28:UDP用户数据包协议(运输层协议)",
        "问题29:TCP传输控制协议(运输层协议)",
        "问题30:TCP的流量控制(作用于点到点)",
        "问题31:TCP的拥塞控制(作用于整个网络)",
        "问题32:TCP的建立(三次握手)",
        "问题33:为什么不是两次握手",
        "问题34:TCP的释放(四次挥手)",
        "问题35:为什么需要挥手四次",
        "问题36:为什么需要等待时间",
        "问题37:简单邮件传送协议SMTP",
        "问题38:pop3邮局协议3",
        "问题39:IMAP邮件读取协议",
        "问题40:MIME通用互联网邮件扩充协议",
        "问题41:p2p协议",
        "问题42:各层协议汇总"
    };
    string result=question[index];
    return result;
}
string input_answer5(int index){
    vector<string>answer=
    {
        "答案1:边缘部分(主机)+核心部分(路由器)",
        "答案2:①速率②带宽③吞吐量④时延(发送时延,传播时延,处理时延,排队时延)⑤时延带宽积(传播时延x带宽)⑥往返时间RTT",
        "答案3:\n①含义:通信前两个节点之间必须要建立连接\n②优点:通信时延小+有序传输\n③缺点:建立连接时间长+线路独占+灵活性低+效率低",
        "答案4:\n①含义:不需要事先建立连接,数据交换的单位是报文\n②优点:无需建立连接+动态分配线路\n③缺点:会引发转发时延+对节点空间有较大要求",
        "答案5:\n①含义:不需要事先建立连接,数据交换的单位是分组\n②优点:减小了发送数据包的大小+降低了出错的概率\n③缺点:可能会出现失序或丢失的情况,接收方需要对分组按照编号进行排序",
        "答案6:\n①应用层:负责处理应用程序之间的通信+处理数据的形式是“报文”\n②传输层:负责提供端到端的通信服务+处理数据的形式是“TCP报文段+UDP数据段”\n③网络层:负责提供端到端的通信服务+处理数据的形式是“分组/数据包”\n④数据链路层:负责相邻节点之间的可靠通信+处理数据的形式是“帧”\n⑤物理层:实现比特流在物理介质上的传输",
        "答案7:从高电平转到低电平就是0,从低电平转到高电平就是1",
        "答案8:相同的时间间隔表示一个二进制数字,这样的时间间隔称为码元",
        "答案9:用来研究信道的极限传输速率与带宽和信噪比之间的关系(这两个越大,则信息的极限传输速率越高)+让每一个码元携带更多比特的信息量。",
        "答案10:在带宽为W的信道中,若不考虑噪声影响,则码元传输的最高速率是2W(码元/秒)。",
        "答案11:①频分复用②时分复用③波分复用(光的频分复用)④码分复用(采用不同的二进制编码方式来区分各路原始信号)",
        "答案12:①封装成帧②透明传输(字节/字符填充)③差错传播(crc冗余校验码)",
        "答案13:\n①集线器:整体作为一个大的碰撞域,每个用户的带宽为B/N\n②交换机:每一个端口都是一个碰撞域并且带宽都为B",
        "答案14:\n①交换机作用于局域网,而路由器可以作用于局域网也可以作用于英特网\n②交换机工作在数据链路层,而路由工作在网络层",
        "答案15:\n①多点接入②载波监听③碰撞检测(基本退避时间/争用期2t)",
        "答案16:\n①基本含义:用户计算机和ISP(互联网提供商)进行通信所使用的数据链路层的协议\n②使用场景:广域网\n③特点:全双工",
        "答案17:\n①将一些分散的设备连接起来,使它们就像在一起一样。\n②一个交换机就是一个冲突域(发送信息的端口),一个vlan网就是一个广播域(接收信息的设备)",
        "答案18:从IP地址中解析出MAC地址",
        "答案19:\n①ICMP差错报告(终点不可达+时间超时)\n②ICMP询问报文(ping)",
        "答案20:\n①使用双协议栈\n②使用隧道技术(在IPv4的数据报中封装IPv6)",
        "答案21:\n①内部网关协议(RIP+OSPF)\n②外部网关协议BGP",
        "答案22:是一种内部网关协议,不需要知道网络的拓扑结构,仅仅和相邻路由器交换信息,属于应用层协议,需要UDP协议",
        "答案23:叫做开放式最短路径优先协议,是一种内部网关协议,采用洪泛法将本自治系统中的所有路由器的链路状态传递,最终每个路由器都能建立全网的拓扑结构图(使用的是Dijkstra路径路由算法,收敛速度快),属于网络层协议,不需要TCP/UDP协议",
        "答案24:\n①用于不同的自治系统的路由器之间交换路由信息的协议,是应用层协议,需要TCP协议。\n②BGP的路由选择协议有三种(本地偏好值最高+AS跳数最小+热土豆路由选择算法)",
        "答案25:允许一台主机发送单一数据包到多台主机的TCP/IP技术",
        "答案26:网络组管理协议,当某台主机加入新的组播组时,该主机向组播组的地址发送一个IGMP报文,声明自己要成为该组的成员,本地组播路由器收到IGMP报文后,将组成员关系转发给因特网组播路由器",
        "答案27:是指通过将专用网络地址转换为公有地址,从而对外隐藏内部网络的IP地址",
        "答案28:\n①简单记忆:简单方便,但不可靠\n②完整记忆:无连接+尽最大努力交付+面向报文+没有拥塞控制+支持一对一、一对多、多对多+全双工",
        "答案29:面向连接的运输层协议+能够提供可靠交付+面向字节流+有拥塞控制(滑动窗口实现)+一对一+全双工",
        "答案30:调整发送方和接收方的滑动窗口,让发送方不要发送得太快,让接收方来得及接收,根本目的是为了防止分组丢失",
        "答案31:\n①含义:防止过多的数据注入到网络中,避免出现网络负荷过大的情况。\n②拥塞控制方法:慢开始+拥塞避免(在拥塞避免阶段,拥塞窗口的增长不再是按照指数增加,而是先找线性)+快重传+快恢复(将新的慢开始的门限设置为当前拥塞窗口的一半)",
        "答案32:\n①客户端发送请求\n②服务器确认\n③客户端确认服务器的确认",
        "答案33:防止已失效的连接请求报文段突然又传送到了,因而产生TCP连接建立错误",
        "答案34:\n①客户端打算断开连接\n②服务器确认\n③服务器也打算断开连接\n④客户端确认",
        "答案35:两次挥手能够实现一端到另一端的TCP连接,完全释放一共需要四次",
        "答案36:保证重传的服务器请求关闭数据包能够被响应",
        "答案37:\n①是一种用于发送电子邮件的协议,负责将邮件从发件人的电子邮箱服务器发送到接收人的电子邮箱服务器\n②基于TCP",
        "答案38:\n①是一种用于接收电子邮件的协议,它允许用户从邮件服务器上下载和接收邮件(POP3会删除被用户读取了的邮件)\n②基于TCP",
        "答案39:\n①用户可以在IMAP上创建和管理文件夹;但是它是一个联机协议,想要查看邮件必须要先联网。\n②基于TCP",
        "答案40:用于解决SMTP协议的一些缺点:\n①不能传输可执行文件和其它的二进制对象\n②服务器会拒绝一定长度的邮件。",
        "答案41:\n①允许网络中节点直接相互通信,而无需通过中央服务器(去中心化(节省中央服务器的带宽压力)+资源共享+可扩展性)",
        "答案42:\n①应用层:SMTP+POP3+IMAP+MIME+P2P\n②传输层:TCP,UDP\n③网络层:ARP.ICMP,RIP,OSPF,BGP,IGMP,NAT\n④数据链路层:CSMA/CD"
    };
     string result=answer[index];
     return result;
}
//功能6子模块
int function6_random_index(){
    srand((int)time(0));  // 产生随机种子  把0换成NULL也行
    int result= rand()%27;
    return result;
}
string input_question6(int index){
    vector<string>question=
    {
        "问题1:三种处理系统",
        "问题2:操作系统的四大特征",
        "问题3:进程并发执行的三个特征",
        "问题4:进程控制块pcb",
        "问题5:进程的5种状态",
        "问题6:原语",
        "问题7:信号量的分类",
        "问题8:经典进程的同步问题",
        "问题9:进程和线程",
        "问题10:三种处理机调度",
        "问题11:处理机调度算法",
        "问题12:死锁",
        "问题13:产生死锁的四大条件",
        "问题14:死锁的处理方法",
        "问题15:物理地址和逻辑地址",
        "问题16:分区分配",
        "问题17:实现动态分区分配的四种算法",
        "问题18:分页存储管理方式(为了解决动态分区分配产生碎片的问题)",
        "问题19:分段和分页的区别",
        "问题20:段页式存储方式",
        "问题21:虚拟存储器(达到内存扩充的功能)",
        "问题22:虚拟存储器的特征",
        "问题23:页面置换算法",
        "问题24:I/O控制方式",
        "问题25:脱机技术和假脱机技术",
        "问题26:四种磁盘调度算法",
        "问题27:四种文件存储空间管理方法"
    };
    string result=question[index];
    return result;
}
string input_answer6(int index){
    vector<string>answer=
    {
        "答案1:\n①单道批处理系统\n②多道批处理系统\n③分时系统\n④实时系统",
        "答案2:\n①并发\n②共享\n③虚拟\n④异步",
        "答案3:\n①间断性\n②失去封闭性\n③不可再现性",
        "答案4:用于记录与进程相关信息的主存区,是进程存在的唯一标识",
        "答案5:\n①活动就绪->(cpu资源调度)->执行\n②执行->(i/o请求)->活动阻塞\n③活动阻塞->(i/o请求完成)->活动就绪\n④活动就绪/执行->(挂起)->挂起就绪->(激活)->活动就绪\n⑤活动阻塞->(挂起)->挂起阻塞->(激活)->挂起就绪",
        "答案6:一个操作中的所有动作,要么全做,要么全不做",
        "答案7:\n①整型信号量\n②记录型信号量\n③AND型信号量\n④信号量集",
        "答案8:\n①生产者与消费者问题\n②哲学家就餐问题\n③读者写者问题",
        "答案9:\n①进程控制块PCB,线程控制块TCB\n②进程是操作系统进行资源分配和和调度的独立单位,线程是一种轻量级的进程,“轻装上阵”",
        "答案10:\n①高级调度\n②低级调度(进程调度)\n③中级调度",
        "答案11:\n①先来先服务FCFS\n②短进程优先算法SPF\n③高优先权算法HRRN\n④时间片轮转调度算法",
        "答案12:两个或两个以上的进程在运行过程中因争夺资源而造成的一种相互等待。",
        "答案13:\n①互斥条件\n②请求和保持条件\n③不可抢占条件\n④循环等待条件",
        "答案14:\n①预防死锁\n②避免死锁\n③检测死锁\n④解除死锁",
        "答案15:\n物理地址是指内存中实际的存储位置,每一个物理地址都对应内存中的一个存储单元。\n逻辑地址是由操作系统分配的地址,实际执行过程中,逻辑地址会转换为物理地址。",
        "答案16:\n①固定分区分配\n②动态分区分配\n③分页式分区分配\n④分段式分区分配\n⑤段页式分区分配",
        "答案17:\n①首次适应算法\n②循环首次适应算法\n③最佳适应算法\n④最坏适应算法",
        "答案18:将一用户的地址空间划分大小相等的区域,称为页;内存空间也划分成若干个与页大小相等的区域,称为物理块;相邻的页分配到不相邻的块中,最后一页可能出现碎片。",
        "答案19:\n每个段的大小不一,每个页的大小相同。\n优点:便于共享,各段之间修改互不影响。\n缺点:内存利用率低,内存碎片浪费大。",
        "答案20:\n先分段,再分页。\n优点:内存利用率高。\n缺点:系统复杂度高,执行速度下降。",
        "答案21:实现请求调入功能和置换功能,逻辑上扩充内存容量,满足小内存运行大程序的需要。",
        "答案22:\n①多次性\n②对换性\n③虚拟性",
        "答案23:\n①最佳置换算法OPT\n②先进先出置换算法FIFO\n③最近最久未使用算法LRU\n④最少使用算法LFU",
        "答案24:\n①轮询的可编程IO方式\n②中断的可编程IO方式\n③DMA访问方式\n④IO通道访问方式",
        "答案25:\n①脱机技术:数据先输入到磁带,再从磁带读入主机。\n②假脱机技术:利用软件模拟脱机过程。",
        "答案26:\n①先来先服务算法FCFS\n②最短寻道时间优先SSTF\n③扫描算法SCAN\n④循环扫描算法C-SCAN",
        "答案27:\n①空闲表法\n②空闲链表法\n③位示图法\n④成组链接法"
    };
     string result=answer[index];
     return result;
}
//功能7子模块
int function7_random_index(){
    srand((int)time(0));  // 产生随机种子  把0换成NULL也行
    int result= rand()%20;
    return result;
}
string input_question7(int index){
    vector<string>question=
    {
        "问题1:冯诺依曼的基本原理",
        "问题2:冯诺依曼计算机的5大组成部分",
        "问题3:BCD码",
        "问题4:RAM和ROM的区别",
        "问题5:RAM的分类",
        "问题6:存储容量的扩充",
        "问题7:可编程ROM分类",
        "问题8:cache存储器",
        "问题9:cache的命中率",
        "问题10:cache的替换策略",
        "问题11:指令的组成部分",
        "问题12:操作数的基本寻址方式",
        "问题13:cpu的基本组成",
        "问题14:cpu中的主要寄存器",
        "问题15:数据冲突",
        "问题16:数据相关",
        "问题17:字,字节和位",
        "问题18:外围设备",
        "问题19:常见的中断源",
        "问题20:多级中断"
    };
    string result=question[index];
    return result;
}
string input_answer7(int index){
    vector<string>answer=
    {
        "答案1:存储程序+程序控制",
        "答案2:运算器,控制器,存储器,输入设备,输出设备。以运算器为中心",
        "答案3:是一种二进制的编码形式,用于表示十进制数",
        "答案4:\n①RAM:易失性存储器(断电后数据会丢失),也叫做随机存取存储器\n②ROM:非易失性存储器(断电后数据不会丢失),也叫做只读存储器",
        "答案5:\n①SRAM静态随机存储器\n组成:6个晶体管组成\n不需要刷新电路,只要有电就能工作\n成本高,容量小,速度快\n②DRAM动态随机存储器\n组成:1个电容和1个晶体管\n因为有电容,搜易需要定期刷新电路\n成本低,容量大",
        "答案6:\n存储容量的表示形式:1Mx4(1M代表容量,x4代表位宽,位数)\n①字扩展\n前变后不变\n②位扩展\n前不变后变",
        "答案7:\n①EPROM可擦写可编程只读存储器\n使用紫外线来进行擦除\n②电可擦可编程只读存储器\n使用高电压来进行擦除",
        "答案8:是一种高速缓冲存储器,主要是为了解决cpu和主存之间速度不匹配而采用的一项技术",
        "答案9:\n命中率与以下几个因素有关:\n①cache的容量,容量越大,命中率越高\n②程序的行为(如果程序经常访问相同的数据集,那么命中率就会更高)\n③组织方式(直接映射,组相连映射,全相联映射(最高))\n④cache块的大小(cache容量=cache块大小x组数)",
        "答案10:\n①随机替换\n②先进先出策略FIFO\n③最不经常使用算法LRU",
        "答案11:有操作码和地址码组成,其中操作码表示指令的操作特性与功能,地址码表示参与操作的操作数的地址",
        "答案12:\n①隐含寻址:指令中隐含着操作数的地址\n②立即寻址:地址码部分不是操作数的地址,而是操作数本身,立即寻址中的操作数叫做立即数\n③直接寻址:地址码给出的地址就是操作数真实的地址\n④间接寻址:地址码给出的地址是操作数地址的地址\n⑤寄存器寻址:操作数的地址放在寄存器中\n⑥寄存器间接寻址:寄存器中存放的是操作数地址的地址\n⑦偏移寻址:直接寻址+寄存器间接寻址\n偏移寻址分为3类:\n相对寻址:程序计数器提供基准地址,外加偏移量\n基址寻址:基址寄存器+偏移量\n变址寻址:变址寄存器+偏移量",
        "答案13:运算器+控制器+cache",
        "答案14:\n①数据缓冲寄存器DR:用于暂存算术逻辑单元ALU的运算结果\n②指令寄存器IR:用来保存当前正在执行的一条指令\n③程序计数器PC:用来存放正在执行的指令的地址,或者将要执行的下一条指令的地址\n④数据地址寄存器AR:用来存放当前cpu访问的数据在cache中的地址\n⑤通用寄存器:用来存放任意一个操作数以及结果\n⑥程序状态字寄存器PSWR:用来记录当前运算的状态以及工作方式",
        "答案15:\n①资源相关\n②数据相关\n③控制相关",
        "答案16:\n①RAW写后读\n②WAW写后写\n③WAR读后写",
        "答案17:1个字(word)4个字节(B),1个字节8位(bit)",
        "答案18:除了cpu和主存之外,计算机系统中的每一部分都可以作为一个外围设备来看待",
        "答案19:\n①输入设备和输出设备的中断\n②数据通道中断(磁盘,磁带要同主机进行数据交换时)\n③实时时钟中断\n④故障中断(电源掉电,设备故障)\n⑤系统中断(运算过程中出现移除,数据格式非法等)",
        "答案20:\n①中断请求触发器IR\n②中断屏蔽触发器IM\n③中断允许触发器IE"
    };
     string result=answer[index];
     return result;
}
//功能8子模块
int function8_random_index(){
    srand((int)time(0));  // 产生随机种子  把0换成NULL也行
    int result= rand()%11;
    return result;
}
string input_question8(int index){
    vector<string>question=
    {
        "问题1:数据项,数据元素,数据对象",
        "问题2:线性表的分类",
        "问题3:顺序表",
        "问题4:单链表",
        "问题5:栈的基本特点",
        "问题6:队列的基本特点",
        "问题7:树的定义",
        "问题8:树的结点分类",
        "问题9:结点的特征",
        "问题10:树的计算性质",
        "问题11:二叉树的分类"
    };
    string result=question[index];
    return result;
}
string input_answer8(int index){
    vector<string>answer=
    {
        "答案1:\n①数据项是每一个属性\n②数据元素是一条数据,里面包含多条数据元素\n③数据对象:是数据元素的集合",
        "答案2:\n①顺序表\n②单链表",
        "答案3:\n①定义:用顺序存储的方法实现线性表的顺序存储,在逻辑上相邻的元素在物理位置上也相邻\n②查找的时间复杂度:O(1)\n③插入和删除的时间复杂度:O(n)\n④优缺点:可以随机存取,存储密度高,但是改变容量不方便",
        "答案4:\n①定义:使用链式存储存储的方式实现线性表的顺序存储\n②插入操作:\n在链表头部插入:时间复杂度为O(1)\n在链表尾部插入:时间复杂度为O(n)\n在链表中间插入:时间复杂度为O(n)\n③删除操作:\n在链表头部删除:时间复杂度为O(1)\n在链表尾部删除:时间复杂度为O(n)\n在链表中间删除:时间复杂度为O(n)\n④查找操作:\n查找一个节点:时间复杂度为O(n)\n查找最大/最小值:时间复杂度为O(n)\n⑤优缺点:属于顺序存取,改变容量简单,但是需要耗费一定的空间来存储指针",
        "答案5:\n①后进先出(LIFO)\n②只允许在一端进行插入或删除操作的线性表\n③只有一个端口,用于各项操作",
        "答案6:\n①先进先出FIFO\n②有两个端口,只能在队尾插入,在队头删除",
        "答案7:除了根节点外,任何一个结点都有且仅有一个前驱",
        "答案8:\n①祖先结点:该结点的父亲,爷爷,一直往上\n②子孙结点:自己往下的所有结点\n③双亲结点:一个结点的直接前驱(爸爸)\n④孩子结点:一个结点的直接后继(儿子)\n⑤兄弟结点:一个爹生的多个儿子\n⑥堂兄弟结点:和你同一层,但不是你爹生的结点",
        "答案9:\n①两个节点的路径长度:只能从上到下,经过了几条边\n②结点的深度:从上往下数,结点所在的层次\n③结点的高度:从下往上数,越往上越大\n④树的高度/深度:也就是有几层\n⑤结点的度:指的是这个节点有几个孩子\n⑥树的度:各个节点中度的最大值",
        "答案10:结点数=总度数+1",
        "答案11:\n①满二叉树\n除了叶子结点外,每一个结点都有左右两个节点\n只有最后一层有叶子结点\n不存在度为1的结点\n当前节点为i,左孩子为2i,右孩子为2i+1,父亲为i/2向下取整\n②完全二叉树\n是满二叉树的一部分,但是按照顺序,结点的位置要能够一一对应\n只有最后两层可能有叶子结点\n最多只有一个度为1的节点\n③二叉排序树\n左边的结点值都小于该结点;\n右边的结点值都大于该结点;\n④平衡二叉树\n所有左子树和右子树的高度差不超过1"
    };
     string result=answer[index];
     return result;
}

bool control(){
    cout<<"输入1进入下一个,输入2退出,请输入:";
    int input;
    cin>>input;
    if(input==1)//enter键
    {
        return true;
    }
    else if(input==2)//退出键
    {
        return false;
    }
}
int main(){
    //第一部分:所有功能页面展示
    int choice=show_functions();
    //第二部分:选择具体功能项目
    choose_function(choice);
}

第三部分:生成exe电脑文件

我运行上述代码使用的是codeblocks,生成后的点击编译并运行:

之后会自动在bin文件夹下生成exe文件:

如果运行出错,缺少dll文件,可以看我的博客:http://t.csdnimg.cn/3Dl8v

自动贩卖系统是一个比较复杂的项目,需要考虑到硬件、软件以及用户体验等多个方面。在这里,我将介绍如何使用ResEdit和CodeBlocks来制作一个简单的自动贩卖系统。 首先,我们需要创建一个Windows应用程序。在CodeBlocks中选择File->New->Project,选择“Win32 GUI project”,设置项目名称和路径,然后按照向导一步一步完成项目的创建。 接下来,我们可以使用ResEdit来设计我们的用户界面。ResEdit是一个可视化的资源编辑器,可以帮助我们创建和编辑Windows应用程序的资源,例如对话框、菜单、图标等。打开ResEdit,然后选择File->New,选择“Dialog”作为资源类型,然后设计自动贩卖机的用户界面,包括商品列表、投币、退币、购买等功能。 完成用户界面设计后,我们需要将其导入到CodeBlocks项目中。在CodeBlocks中打开项目,然后选择Project->Add Files,选择我们刚刚创建的资源文件,将其添加到项目中。然后在项目中的代码中调用这些资源,例如: ```c++ #include <windows.h> #include "resource.h" HWND hDlg; BOOL CALLBACK DialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { switch(uMsg) { case WM_INITDIALOG: hDlg = hwnd; return TRUE; case WM_COMMAND: switch(LOWORD(wParam)) { case IDCANCEL: EndDialog(hwnd, 0); return TRUE; case IDOK: // 处理购买商品的逻辑 return TRUE; } } return FALSE; } int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { DialogBox(hInstance, MAKEINTRESOURCE(IDD_DIALOG), NULL, DialogProc); return 0; } ``` 运行程序,我们就可以看到我们刚刚设计的自动贩卖机界面了。当用户点击购买按钮时,我们需要编写相应的逻辑来完成交易、扣款等操作。 这只是一个简单的自动贩卖机系统,如果想要实现更多的功能,例如支付宝支付、商品库存管理等,需要更加复杂的代码和逻辑。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

还不秃顶的计科生

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值