请C++编程高手赐教!由于分割问题不方便解答所以干脆把全题写出,请大侠搭救。

来源:百度知道 编辑:UC知道 时间:2024/06/24 15:16:29
2.计算机在教育领域的作用越来越大,编写一个程序,帮助小学生学习加,减,乘,除四则运算.要求如下:

(1)用 函数产生两个正整数,然后输出下列问题:How much is 6 times 7?,然后学生输入答案,程序检查学生的答案.
(2)为了提高学生的学习兴趣,如果正确,则程序随机打印"Very good!","Excellent","Nice Work","Keep up the good work!"
四个评语之一.如果学生答错,则随机打印”Wrong","Try once again","Con`t give up!","No.Keep trying."四个评语之一.
(3)学生输入10个答案后,程序计算其答对率.如果比率不到75%,则程序打印”Please ask your instructor for extra",然后终止.
(4)让用户输入级别.1级表示只用一位数,2级表示可用两位数等等.
(5)让用户输入要学习的算术类型,1表示加法,2表示减法,3表示乘法,4表示除法,5表示混合运算.

#include <iostream>
#include <cstdlib>
#include <string>
#include <assert.h>

/***************************************
helper类
成员函数
---生成数字
---生成运算符
---生成奖励评语
---告错评语
*****************/

int operation;
int gradte;
int number(0);
int conter; //循环计数器
int anotherconter; //记录回答正确次数
int realresult; //算式结果
int result; //输入结果
int a,b; //随机数字

class helper
{
int digit();
char type(char operate);
char alltype();

static std::string getgood();
static std::string getbad();
};

/*************************
---生成运算符
*************************/

int digit()
{
switch(gradte)
{
case 1:
number = rand()%10;
break;
case 2:
number = rand()%100;
break