小学算术题
来源:互联网 发布:位置虚拟定位软件 编辑:程序博客网 时间:2024/04/29 07:17
#include <iostream>
#include<ctime>
#include<cstdlib>
using namespace std;
int main()
{
srand(time(0));
int i,right=0,result,amount=1,m,n;
int x,y;
for(i=1;i<=10;i++)
{
x=rand()%100;
y=rand()%100+1;
cout<<"第"<<amount<<"题: ";
m=x%4;
if(x<y)
{
n=x;
x=y;
y=n;
}
if(m==0)
{
cout<<x<<"+"<<y<<"=";
cin>>result;
if(result==(x+y))
{
cout<<"right"<<endl;
right++;
}
else
cout<<"wrong"<<endl;
}
else if(m==1)
{
cout<<x<<"-"<<y<<"=";
cin>>result;
if(result==(x-y))
{
cout<<"right"<<endl;
right++;
}
else
cout<<"wrong"<<endl;
}
else if(m==2)
{
cout<<x<<"*"<<y<<"=";
cin>>result;
if(result==(x*y))
{
cout<<"right"<<endl;
right++;
}
else
cout<<"wrong"<<endl;
}
else if(m==3)
{
int yushu;
cout<<x<<"/"<<y<<"=";
cin>>result>> yushu;
if(result==(x/y)&&yushu==(x%y))
{
cout<<"right"<<endl;
right++;
}
else
cout<<"wrong"<<endl;
}
amount++;
}
cout<<"正确"<<right<<"道题,最终得分为"<<10*right;
return 0;
}
#include<ctime>
#include<cstdlib>
using namespace std;
int main()
{
srand(time(0));
int i,right=0,result,amount=1,m,n;
int x,y;
for(i=1;i<=10;i++)
{
x=rand()%100;
y=rand()%100+1;
cout<<"第"<<amount<<"题: ";
m=x%4;
if(x<y)
{
n=x;
x=y;
y=n;
}
if(m==0)
{
cout<<x<<"+"<<y<<"=";
cin>>result;
if(result==(x+y))
{
cout<<"right"<<endl;
right++;
}
else
cout<<"wrong"<<endl;
}
else if(m==1)
{
cout<<x<<"-"<<y<<"=";
cin>>result;
if(result==(x-y))
{
cout<<"right"<<endl;
right++;
}
else
cout<<"wrong"<<endl;
}
else if(m==2)
{
cout<<x<<"*"<<y<<"=";
cin>>result;
if(result==(x*y))
{
cout<<"right"<<endl;
right++;
}
else
cout<<"wrong"<<endl;
}
else if(m==3)
{
int yushu;
cout<<x<<"/"<<y<<"=";
cin>>result>> yushu;
if(result==(x/y)&&yushu==(x%y))
{
cout<<"right"<<endl;
right++;
}
else
cout<<"wrong"<<endl;
}
amount++;
}
cout<<"正确"<<right<<"道题,最终得分为"<<10*right;
return 0;
}
0 0
- 小学算术题
- 给小学生出算术题
- 小学算术
- 一道小学算术题,忽悠了全国人民.
- POJ_3444_小学算术
- 一道85%网民做错的小学算术题
- 一道85%的做错的小学算术题
- 生成小学算术题——小程序
- 算术练习--小学算术练习软件
- 10个大学生9个答错的小学算术题,考考你的智商
- 一道看起来简单的小学算术题,却总是得不到正确答案。不信,你试试看!!!!
- 基础语言-题目74(小学算术)
- 蜗牛!快爬!(小学算术问题)
- 第47讲 小学百以内算术练习题库
- 算术题
- 小学奥林匹克题
- 小学升初中题
- ACM-签到 小学题
- (6)POI生成Excel文件
- Hust oj 1159 MAGI System(大数乘法)
- Spark 基础——RDD 详解
- HDU 小Q系列故事——电梯里的爱情
- leetcode 129. Sum Root to Leaf Numbers
- 小学算术题
- HashMap类的JDK实现剖析
- OBB碰撞检测算法
- HDU 4686 Arc of Dream(构造矩阵)
- visual studio 2013上搭建arm交叉编译环境(三)Visual studio2013中Cygwin工程的建立
- java线程池
- #("The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name:")
- C语言数据类型在32位机和64位机下的区别
- prototype 的理解