如何用C++实现生成1-100的随机小数一个,该数精确到小数点后两位

如题所述

#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;
}

望采纳

温馨提示:内容为网友见解,仅供参考
无其他回答
相似回答