11智能在线
新记
如何用C++实现生成1-100的随机小数一个,该数精确到小数点后两位
如题所述
举报该文章
相关建议 2016-07-19
#include<iostream>
using namespace std;
int main()
{
double n=(rand()%100),m=(rand()%10),q=(rand()%10);
double a=n+m/10+q/100;
cout<<a;
return 0;
}
望采纳
温馨提示:内容为网友见解,仅供参考
当前网址:
https://11.t2y.org/zz/fvq4vmqsmp4q2mv4474.html
其他看法
无其他回答
相似回答
大家正在搜
相关问题
我有一段C++函数,是关于生成随机数的,如何更改它输出值的小...
请问,如何在C或者C++里面,产生一个随机的[-1,1]之间...
我有一段C++的函数,运行结果是生成100个随机数,这些数的...
如何自定义数据类型,使之能精确到小数点后100位,用c++语...
如何编写1-100中两位小数点的数
C# 如何生成一个随机数,0到1之间的,保留小数点2位
安卓开发中,我想生成一个在a、b之间的随机数,并且随机数可以...
用C++6.0编写0到100的数,偶数以两位小数点输出。比如...