From 49ea4733172025c55ee11353e4610f5875365ce7 Mon Sep 17 00:00:00 2001 From: Harshil Darji Date: Sat, 8 Oct 2016 15:40:36 +0530 Subject: [PATCH] Computer Oriented Statistical Methods --- Bisection_method.CPP | 53 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 Bisection_method.CPP diff --git a/Bisection_method.CPP b/Bisection_method.CPP new file mode 100644 index 000000000..b178f0f52 --- /dev/null +++ b/Bisection_method.CPP @@ -0,0 +1,53 @@ +#include +#include +#include + +float eq(float i) +{ + return (pow(i,3)-(4*i)-9); // original equation +} + +void main() +{ + float a,b,x,z; + clrscr(); + for(int i=0;i<100;i++) + { + z=eq(i); + if(z>=0) + { + b=i; + a=--i; + goto START; + } + } + + START: + + cout<<"\nFirst initial: "< 0 && z<0.0009) // stoping criteria + { + goto END; + } + } + + END: + cout<<"\n\nRoot: "<