#include "stdafx.h" #include <stdio.h> #include <conio.h> #include <math.h> #include <iostream.h> #define pi 3.14 int a; double f(double x) { return a*x-(((pi)/2)-atan(x)); } int main() { int n=0; double b,c,d,eps; eps=0.0000001; b=0; cout<<"Given the equation: ax=arcctgx \n"; cout<<"a="; cin>>a; cout<<"endpoint="; cin>>c; do { d=(b+c)/2; if (f(d)*f(b)<=0) c=d; else b=d; n+=1; } while (fabs(b-c)>=eps); cout<<"answer: "<<d<<"\n"; cout<<"number of iterations: "<<n<<"\n"; getch(); return 0; }