?? d3r5.cpp
字號:
#include "iostream.h"
#include "math.h"
double func2(double x)
{
return 1.0 / sqrt(x);
}
double fint2(double x)
{
//integral of func2
return 2.0 * sqrt(x);
}
void main()
{
//program d3r5
//driver for routine midpnt
const int nmax = 10;
double s,a = 0.0;
double b = 1.0;
cout<<endl;
cout<<"integral of func2 computed with midpnt"<<endl;
cout.precision(6);
cout<<endl;
cout<<"actual value of integral is"<<" ";
cout<<(fint2(b) - fint2(a))<<endl;
cout<<endl;
cout<<" n approx.integral"<<endl;
cout.setf(ios::fixed|ios::right);
for (int i = 1; i<=nmax; i++)
{
midpnt(a, b, s, i);
cout.width(5);
cout<<i;
cout.width(15);
cout<<s<<endl;
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -