随机数生成---加法学习工具
2012-04-12 23:40
148 查看
#include <iostream>
#include <cstdlib>
#include <ctime>
using namespace std;
void main()
{
srand(time(0));
int a = rand() % 100;
int b = rand() % 100;
int c = rand() % 100;
cout<<a<<"+"<<b<<"+"<<c<<"="<<endl;
int answer;
cin>>answer;
cout<<((answer == a + b + c) ? "right" : "wrong")<<endl;
}
#include <cstdlib>
#include <ctime>
using namespace std;
void main()
{
srand(time(0));
int a = rand() % 100;
int b = rand() % 100;
int c = rand() % 100;
cout<<a<<"+"<<b<<"+"<<c<<"="<<endl;
int answer;
cin>>answer;
cout<<((answer == a + b + c) ? "right" : "wrong")<<endl;
}
相关文章推荐
- 算法问题征解:怎样生成随机数而不借助任何工具?
- (转)随机数生成工具
- python学习重温(2)---自动case生成工具之elementtree
- webpack前端构建工具学习总结(四)之自动化生成项目中的html页面
- 适应于Oracle和Sql Server的实体生成工具〔自已写的,用于学习和交流,很好用)
- C++学习笔记:随机数的生成、double和float的区别
- myEclipse7.5中安装 javascript,extjs的代码自动提示spket插件和extjs desiner可视化代码生成工具,extjs的一个很好的学习视频资源地址
- Eclipse开发工具学习之道:用Eclipse生成jar文件
- 【学习笔记】C语言 随机数的生成原理分析和各类随机数公式
- 学习笔记一:Javascript生成随机数
- Python学习笔记(2):生成随机数
- python模块学习-----加密、随机数生成
- 生成随机数工具
- Python模块学习 ---- random 随机数生成
- Python模块学习 ---- random 随机数生成
- python学习之路-生成随机数和md5加密
- python学习重温(1)---自动case生成工具
- 微软StockTrader 2.03 学习笔记(4)--配置数据库生成工具介绍
- 数组的生成及其随机数【OpenCV学习笔记2】
- Numpy学习笔记之随机数生成