孩子不懂事写着玩的,有两个模式分别是easy(两位数乘法),和difficult(两位数三位数混杂版),没事干的时候提升一下自己羸弱的计算水平。用的c++。

#include <bits/stdc++.h>

using namespace std;
//计算的函数
void CalculateEasy();
void CalculateDifficult();

int win=0,flase=0;

//主函数
int main()
{
    int CalculateSum = 0;
    srand((unsigned)time(NULL));
    //温馨提示
    cout << "Welcome to join us for promoting your arithmetic capability." << endl;
    cout << "We have ten questions in a set." << endl;
    cout << "After completing one set, you can input '0' to end this practice." << endl;
    cout << "Now, let's go. " << endl;
    cout << endl;
    //主体
    while(1){
        CalculateSum++;
        string order="";
        //判断这是第几组,使用第几组的英语
        switch (CalculateSum){
            case 1:order = "1st";break;
            case 2:order = "2nd";break;
            case 3:order = "3rd";break;
            default: order = CalculateSum+1 + " th";break;
        };
        cout << "This is the " << order << " set." << endl;
        cout << endl;
        //选择难度,进行练习
        cout << "please set the level of difficulty:"<< endl;
        cout << "Easy'1', Difficulty '0'" << endl;
        int tmp;
        cin >> tmp;
        if (tmp) CalculateEasy();
        else CalculateDifficult();
        //判断是否进入下一次练习
        cout << "Another set?((yes'1', No'0')" <<endl;
        cin>>tmp;
        if (!tmp) break;
    }
    //输出测试结果
    printf("Through this exercise, You practiced %d sets,%d correct and %d wrong.",CalculateSum,win,flase);
    return 0;
}

//函数区域
void CalculateEasy(){
         for(int i=0;i<10;i++){
            int num1 = (rand()%(100-10))+10;
            int num2 = (rand()%(100-10))+10;
            int sum = num1 * num2;
            cout << i + 1 << ". " << num1 << "*" << num2 << "=" <<endl;
            cout << "Please input your answer."<<endl;
            int ans;
            cin>>ans;
            if(ans==sum) cout << "good job!" <<endl,win++;
            else cout << "What a pity! The answer is" << sum <<endl,flase++;
        }
}

void CalculateDifficult(){
        for(int i=0;i<10;i++){
            int num1 = (rand()%(1000-10))+10;
            int num2 = (rand()%(1000-10))+10;
            int sum = num1 * num2;
            cout << i + 1 << ". " << num1 << "*" << num2 << "=" <<endl;
            cout << "Please input your answer."<<endl;
            int ans;
            cin>>ans;
            if(ans==sum) cout << "good job!" <<endl,win++;
            else cout << "What a pity! The answer is" << sum <<endl,flase++;
        }
}