this is a program which will help you to find the roots of any given function....
and please note that i have made comments on the lines which compiler gives an error.
actually it compiles really well.
i think it is something wrong in the values which are assigned to floating point variables.
my email is <snipped email>

> and please note that i have made comments on the lines which compiler gives an error.
> actually it compiles really well.

If you say that it compiles well, how come it has so many "errors"?

A good idea would be to post the code here instead of including it as an attachment; it's kind of a hassle to download the file and open it with our editor, you know?

As for your problem - sorry, I'm not that good at math. I kind of understand it; maybe someone with better math skills can explain this better...

As you noted in the bottom of your program, the variables are not completely accurate, and will sometimes contain a number that should be 0, but is instead something very close to 0. This can screw up your program, and is a common problem with other math problems such as matrix math. The best solution is to round down the number to 0 if it's smaller than a certain value (say 0.01; you might have to fine-tune it a little bit better).

how come it doesn't compile....it compiles really well in VISUAL C++ 6.0 without a single error.ok as u told me how do i round up the value and assign it to a variable.
eg:
i have 0.33345
and 0.003333

without using a if cond will i be able to assign the value 0 to the variable?

It depends on what kind of requirement is behind the rounding but you can do something like :

x = floor (0.23) ; // 0
x = floor (0.90) ; // 0
Member Avatar for iamthwee

>which will help you to find the roots of any given function

Will it? The best way to find the roots of any given function, assuming the function has only one variable is to use numerical methods.

Some functions can also have complex solutions...

http://en.wikipedia.org/wiki/Root-finding_algorithm

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.