x******a 发帖数: 6336 | 1 求$\int_0^1e^{x^2} \,dx$, 为什么下面这段code总是返回1?谢谢
#include
#include
using namespace std;
double uniRand()
{
return double(rand()/RAND_MAX);
}
int main()
{
srand((unsigned)time(0));
//number of draws;
int N;
cout<<"enter N: "<
cin>>N;
double result=0;
//integrand
for(int i=0; i< N; i++)
{
double temp=pow(uniRand(),2);
re... 阅读全帖 |
|