#include<iostream>
#include<cmath>
using namespace std;
double x[10],y[10];
double f(double a,double b)
{
double c;
c=b-a*2.0/b;
return (c);
}
int main()
{
double x0,y0,h,N,n,x1,y1,yp,yc;
cout<<"x0:";
cin>>x0;
cout<<"y0:";
cin>>y0;
cout<<"h:";
cin>>h;
cout<<"N:";
cin>>N;
n=1;
while(n!=N)
{
x1=x0+h;
yp=y0+h*f(x0,y0);
yc=y0+h*f(x1,yp);
y1=(yp+yc)/2;
cout<<"x1:"<<x1<<" "<<"y1:"<<y1<<endl;
n=n+1;
本内容试读结束,登录后可阅读更多
下载后可阅读完整内容,剩余1页未读,立即下载