Скачиваний:
13
Добавлен:
01.05.2014
Размер:
369 б
Скачать
#include <iostream.h>
#include <math.h>
#include <conio.h>
#include <stdio.h>

double f (double x)
{
  return (x*x+2*x);
  };
  void main()
   {
	double x0=1,x1,h=0.01,e=0.000001,a,b;
	if(f(x0)<f(x0+h))
	h=-h;
	x1=x0+h;
	while(f(x1)<=f(x0))
	{
	x0=x1;
	x1=x0+h;
	h=2*h;
	}
	b=x0;
	a=x1;
	clrscr();
	cout<<"a="<<a<<"\n";
	cout<<"b="<<b<<"\n";
}
Соседние файлы в папке all