小学生算数问题
来源:互联网 发布:佳能mg3680清零软件 编辑:程序博客网 时间:2024/04/29 10:14
/*
*Copyright(c)2014,烟台大学计算机与控制工程学院
*All rights reserved.
*文件名称:asd.cpp
*作 者:綦鹏
*完成日期:2016年3月28日
*版 本 号:v1.0
*
*问题描述:小学生计算题
*输入描述:你的结果
*程序输出:正确个数
*/
#include <iostream>
#include<ctime>
#include<cstdlib>
using namespace std;
int main()
{
int x,y,z,p=0;
int t,i;
srand(time(0));
for(i=0;i<10;i++)
{
x=rand()%100;
y=rand()%100;
t=rand()%4;
if(t==0) cout<<x<<"+"<<y<<"="<<endl;
if(t==1) cout<<x<<"-"<<y<<"="<<endl;
if(t==2) cout<<x<<"×"<<y<<"="<<endl;
if(t==3) cout<<x<<"÷"<<y<<"="<<endl;
if(x/y&&y==0)
continue;
cout<<"请输入答案:";
cin>>z;
if(t==0&&x+y==z)
{
cout<<"right";
p++;
}
else if(t==1&&x-y==z)
{
cout<<"right";
p++;
}
else if(t==2&&x*y==z)
{
cout<<"right";
p++;
}
else if(t==3&&x/y==z)
{
cout<<"right";
p++;
}
else
cout<<"wrong";
cout<<endl;
}
cout<<"你一共作对"<<p<<"道题"<<endl;
return 0;
}
*Copyright(c)2014,烟台大学计算机与控制工程学院
*All rights reserved.
*文件名称:asd.cpp
*作 者:綦鹏
*完成日期:2016年3月28日
*版 本 号:v1.0
*
*问题描述:小学生计算题
*输入描述:你的结果
*程序输出:正确个数
*/
#include <iostream>
#include<ctime>
#include<cstdlib>
using namespace std;
int main()
{
int x,y,z,p=0;
int t,i;
srand(time(0));
for(i=0;i<10;i++)
{
x=rand()%100;
y=rand()%100;
t=rand()%4;
if(t==0) cout<<x<<"+"<<y<<"="<<endl;
if(t==1) cout<<x<<"-"<<y<<"="<<endl;
if(t==2) cout<<x<<"×"<<y<<"="<<endl;
if(t==3) cout<<x<<"÷"<<y<<"="<<endl;
if(x/y&&y==0)
continue;
cout<<"请输入答案:";
cin>>z;
if(t==0&&x+y==z)
{
cout<<"right";
p++;
}
else if(t==1&&x-y==z)
{
cout<<"right";
p++;
}
else if(t==2&&x*y==z)
{
cout<<"right";
p++;
}
else if(t==3&&x/y==z)
{
cout<<"right";
p++;
}
else
cout<<"wrong";
cout<<endl;
}
cout<<"你一共作对"<<p<<"道题"<<endl;
return 0;
}
0 0
- 小学生算数问题
- 小学生算数
- 小学生算数
- 小学生算数
- 小学生算数
- 小学生算数
- 小学生算数
- 小学生算数
- 小学生算数进位
- 小学生算数系统
- 小学生算数系统
- 小学生算数测试系统
- nyoj74小学生算数
- NYOJ小学生算数
- NYOJ 74 小学生算数
- 小学生算数测试
- 小学生算数测试系统
- ACM:蓝桥杯:小学生算数
- Java千百问_03基本语法(005)_二进制是怎样做位运算的
- 《Android开发艺术探索》Android中的IPC方式--未完
- zjnu 1779 KRUŽNICE(线段树成段更新+离散化)
- insmod module.ko 出现Invalid parameters, dmesg显示信息:disagrees about version of symbol..
- Python的可视化工具概述
- 小学生算数问题
- HTML+servlet+js(使用ajax传参) 出现中文乱码
- redis和spring整合
- HDU 1213 How Many Tables
- HTML基础
- [HDU]ACM Steps-Chapter One-Section 3
- NCRE - 嵌入式系统开发工程师 – 计算机组成原理(随笔)
- CSS核心内容定位和浮动
- filemon网页链接