test.cpp
来自「数值计算方法中的,牛顿向前和向后算法. 以前花了很长时间编写的,希望对后来的师」· C++ 代码 · 共 28 行
CPP
28 行
#include "iostream.h"
#include "NewtonFor.h"
#include "NewtonBack.h"
int main(void)
{
NewtonFor nf;
NewtonBack nb;
float x[]={0,1,2,3};
float y[]={1,3,5,12};
float xx;
nf.SetData(x,y,4);
nf.CreateTable();
nb.SetData(x,y,4);
nb.CreateTable();
cout<<"please enter the x value"<<endl;
cin>>xx;
cout<<"the result of NewtonForward is "<<nf.Cal(xx)<<endl;
cout<<"the error of NewtonForward is "<<nf.Cal_Error(xx)<<endl;
cout<<"the result of NewtonBackWard is "<<nb.Cal(xx)<<endl;
cout<<"the error of NewtonBACKward is "<<nb.Cal_Error(xx)<<endl;
return 0;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?