Hello, this is my first post.
I am trying to figure out this program written in C that finds the roots of a polynomial through the message of bisection. Whenever I try to compile it using Dev-C++ I get the error [Linker error] undefined reference to `WinMain@16' . I am trying to compile it as "console application" with no luck..
Any suggestions would be appreciated! -Thanks
#include
I am trying to figure out this program written in C that finds the roots of a polynomial through the message of bisection. Whenever I try to compile it using Dev-C++ I get the error [Linker error] undefined reference to `WinMain@16' . I am trying to compile it as "console application" with no luck..
Any suggestions would be appreciated! -Thanks
#include
[Error: Irreparable invalid markup ('<math.h>') in entry. Owner must fix manually. Raw contents below.]
Hello, this is my first post.
I am trying to figure out this program written in C that finds the roots of a polynomial through the message of bisection. Whenever I try to compile it using Dev-C++ I get the error [Linker error] undefined reference to `WinMain@16' . I am trying to compile it as "console application" with no luck..
Any suggestions would be appreciated! -Thanks
<lj-cut>
#include <math.h>
#define JMAX 40
float rtbis(float (*func)(float), float x1, float x2, float xacc)
{
int main( void );
int j;
float dx,f,fmid,xmid,rtb;
f=(*func)(x1);
fmid=(*func)(x2);
if (f*fmid >= 0.0) printf("Root must be bracketed for bisection in rtbis");
rtb = f < 0.0 ? (dx=x2-x1,x1) : (dx=x1-x2,x2);
for (j=1;j<=JMAX;j++) {
fmid=(*func)(xmid=rtb+(dx *= 0.5));
if (fmid <= 0.0) rtb=xmid;
if (fabs(dx) < xacc || fmid == 0.0) return rtb;
}
printf("Too many bisections in rtbis");
return 0.0;
}
</lj-cut>
I am trying to figure out this program written in C that finds the roots of a polynomial through the message of bisection. Whenever I try to compile it using Dev-C++ I get the error [Linker error] undefined reference to `WinMain@16' . I am trying to compile it as "console application" with no luck..
Any suggestions would be appreciated! -Thanks
<lj-cut>
#include <math.h>
#define JMAX 40
float rtbis(float (*func)(float), float x1, float x2, float xacc)
{
int main( void );
int j;
float dx,f,fmid,xmid,rtb;
f=(*func)(x1);
fmid=(*func)(x2);
if (f*fmid >= 0.0) printf("Root must be bracketed for bisection in rtbis");
rtb = f < 0.0 ? (dx=x2-x1,x1) : (dx=x1-x2,x2);
for (j=1;j<=JMAX;j++) {
fmid=(*func)(xmid=rtb+(dx *= 0.5));
if (fmid <= 0.0) rtb=xmid;
if (fabs(dx) < xacc || fmid == 0.0) return rtb;
}
printf("Too many bisections in rtbis");
return 0.0;
}
</lj-cut>
