| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1068 人关注过本帖
标题:小学算术测试程序(谢谢大家,急用)
只看楼主 加入收藏
pofanwan
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2007-12-14
收藏
 问题点数:0 回复次数:2 
小学算术测试程序(谢谢大家,急用)
小学算术测试程序
1 操作界面美观简洁。
2 测试小学生对10以内两个正数加,减,乘法运算的能力。
3 能根据用户输入确定出题数。
4 随机出题,运算数必须是10以内的正整数,运算符可以是加减乘。
5 判断解答是否正确,如果答案错误允许学生重做,在界面上给出提示。
6 累计并显示题数.正确问答次数和错误次数。
7 统计正确率(百分制),并给出相应提示(比如:90分以上输出“Very  good!”)

这是我们的课设题目,12月17日交,大家帮帮我啊,急用啊.谢谢大家
搜索更多相关主题的帖子: 算术 小学 
2007-12-14 22:26
scmsgxz
Rank: 1
等 级:新手上路
帖 子:23
专家分:0
注 册:2007-6-11
收藏
得分:0 
呵呵,好像以前做过类似的,不过那时候没有什么保留代码的习惯,呵呵!感觉还是应该比较简单的呀 !

人嘛,过嘛,耍嘛,悲嘛,喜嘛,死嘛,烧求了嘛,丢求了嘛!
2007-12-15 09:33
mfkpgfsbihc
Rank: 1
等 级:新手上路
帖 子:17
专家分:0
注 册:2007-11-25
收藏
得分:0 
#include<iostream>
#include<cstdlib>
#include<ctime>
using namespace std;

class Arith{
private:
    int right,wrong;
    int num;
public:
    Arith(){
        right=0;wrong=0;num=0;}
    void setNum();
    int getNum()const{return num;}
    void doing();
    void statistics();
};

void Arith::setNum(){
    cout<<"输入答题数目:";
    int number;
    cin>>number;
    num=number;
    printf("你已确定答题数目,请选择答题选项.\n");
    system("pause");
}
void Arith::doing(){
    int i;
    int num1,num2,middle,result;
    char symbol;
    system("cls");
    for(i=1;i<=num;i++){
        cout<<"答题数:"<<i-1;
        cout<<"  正确次数:"<<right<<"  错误次数:"<<wrong<<endl;
        cout<<"第"<<i<<"题:"<<endl;
        srand(time(NULL));
        num1=rand()%9;
        num2=rand()%9;
        middle=rand()%3+1;
        switch(middle){
        case 1:symbol='+';
            cout<<num1<<symbol<<num2<<"=";
            cin>>result;
            if(result==num1+num2)
                right++;
            while(result!=num1+num2){
                cout<<"答案错误!重新输入:\n";
                wrong++;
                cout<<num1<<symbol<<num2<<"=";
                cin>>result;
            }
            break;
        case 2:symbol='-';
            while(num1<num2){
                num1=rand()%9;
                num2=rand()%9;
            }
            cout<<num1<<symbol<<num2<<"=";
            cin>>result;
            if(result==num1-num2)
                right++;
            while(result!=num1-num2){
                cout<<"答案错误!重新输入:\n";
                wrong++;
                cout<<num1<<symbol<<num2<<"=";
                cin>>result;
            }
           
            break;
        case 3:symbol='*';
            cout<<num1<<symbol<<num2<<"=";
            cin>>result;
            if(result==num1*num2)
                right++;
            while(result!=num1*num2){
                cout<<"答案错误!重新输入:\n";
                wrong++;
                cout<<num1<<symbol<<num2<<"=";
                cin>>result;
            }
        }
    }
    cout<<"答题数:"<<i-1;
    cout<<"  正确次数:"<<right<<"  错误次数:"<<wrong<<endl;
    cout<<"你已做完所有题目,查看做题情况进入统计选项\n";
    system("pause");
}

void Arith::statistics(){
    float rate;
    if(num==0){
        cout<<"你还没有做题呢.\n";
        goto end;
    }
    system("cls");
    cout<<"\n\n\n";
    cout<<"\t\t------------------------------------\n";
    cout<<"\t\t-   你一共做了"<<num<<"道题目              -  \n";
    cout<<"\t\t-      正确次数为:"<<right<<"                -  \n";
    cout<<"\t\t-      错误次数为:"<<wrong<<"                -  \n";
    cout<<"\t\t------------------------------------\n";
    rate=float(right)/float(num);  //重做的累加正确数目
    switch(int(rate*10)){
    case 0:
    case 1:
    case 2:
    case 3:case 4:cout<<"\t\t看样子你得努力了,哎!\n";break;
    case 5:cout<<"\t\t加油,差一点点就及格了!\n";break;
    case 6:
    case 7:cout<<"\t\t还行,不过要想考高分就得继续加油.\n";break;
    case 8:cout<<"\t\t儒子可教也!\n";break;
    case 9:
    case 10:cout<<"\t\t非常之好,继续努力吧!\n";
    }
    end:;
    system("pause");
}

void menu(){
    cout<<endl;
    cout<<endl;
    cout<<"\t\t--------------------------------------\n";
    cout<<"\t\t-        1.选择答题数目              -\n";
    cout<<"\t\t-        2.开始答题                  -\n";
    cout<<"\t\t-        3.统计答题结果              - \n";
    cout<<"\t\t-        4.退出                      - \n";
    cout<<"\t\t--------------------------------------\n";
}

int main(){
    Arith doWork;
    int choice;
    while(1){
        system("cls");
        menu();
        cout<<"你选择(1-4):";
        cin>>choice;
        switch(choice){
        case 1:doWork.setNum();
            break;
        case 2:if(0==doWork.getNum()){
               doWork.setNum();
               }
            doWork.doing();
            break;
        case 3:doWork.statistics();
            break;
        case 4:goto end;
        default:
            cout<<"选择错误,重新输入.\n";
            system("pause");
        }
    }
end:;
    cout<<"谢谢使用,再见!\n";

   return 0;
}
2007-12-16 21:11
快速回复:小学算术测试程序(谢谢大家,急用)
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.021640 second(s), 9 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved