d10r2.cpp
来自「工程算法 这是一个很有用的工程数值算法集锦」· C++ 代码 · 共 40 行
CPP
40 行
#include <process.h>
#include <math.h>
#include <iomanip.h>
#include <iostream.h>
double fun(double x)
{
double t;
t=bessj0( x);
return t;
}
void main()
{
//program d10r2
//driver for routine zbrac
bool succes;
int i;
double x1,x2;
cout<<endl;
cout<<" bracketing values: function values:"<<endl;
cout<<endl;
cout<<" x1 x2 bessj0(x1) bessj0(x2)";
cout<<setprecision(2)<<setiosflags(ios::fixed);
for (i = 1; i<=10; i++)
{
x1 = double(i);
x2 = x1 + 1;
zbrac(x1, x2, succes);
if (succes)
{
cout<<setprecision(2)<<setw(8)<<x1;
cout<<setprecision(2)<<setw(8)<<x2;
cout<<setprecision(6)<<setw(14)<<bessj0(x1);
cout<<setprecision(6)<<setw(14)<<bessj0(x2);
}
}
cout<<endl;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?