/*
*Copyright(c)2016,烟台大学计算机学院
*All right reserved.
*文件名称:test.cpp
*作者:黄金婵
*完成日期:2016年4月16日
*版本号:v1.0
*
*问题描述:提供10道加、减、乘、除四种基本算术运算的题目,每道题中的操作数是随机产生的,且操作数不超过2位数的正整数;程序自动判断输入的答案是否正确并显示出相应的信息。最后显示做对了几道题。
*输入描述:答案
*程序输出:right/wrong,答对了*道题。
*/
#include <iostream>
#include<ctime>
#include<cstdlib>
int qa();
using namespace std;
int main()
{
int i;
int sum=0;
for(i=0;i<10;i++)
{
cout<<"第"<<i+1<<"道题:"<<endl;
sum=sum+qa();
cout<<endl;
}
cout<<"答对了"<<sum<<"道题"<<endl;
return 0;
}
int qa()
{
srand(time (0));
int a,b,c,d,t;
a=rand()%100+1;
b=rand()%100+1;
c=rand()%4;
if(a<b&&(c=
第四周项目:小学生算术能力测试系统
最新推荐文章于 2020-08-09 10:37:59 发布