#include<iostream.h> #include<conio.h> Class regula { float x0,x1,step; Public: Void input ( ); Voidcalculate ( ); }; float f(float x) { return x*x*x+x*x+9; }; Void regula:: input ( ) { Cout<< "enter the value:" ; Cin>>x0,x1,step; } Void regula:: calculate ( ) { float x2; for(into i=0;i>=step;i++;) { x2=x0*f(x1)-x1*f(x0)/f(x1)-f(x0); } Cout<< "value of roots" <<x2; if(x2<0) x1=x2; else x0=x2 } Void main( ) { Clrscr ( ); regula r; r.input( ); r.calculate( ); getch( ); };
GKVPAPER, Gurukul Kangri Vishwavidyalaya Papers, B.sc 1st year(l,ll Semester),2nd year(lll,lV Semester), 3rd year(V,Vl Semester)