It has been happening to me ever since I started writing codes.I write a code, it runs, gives me the right outcome and then the next time I run it again or rewrite the code it gives me weird answers or doesn't even work even though I basically copy and paste it. for example the code bellow...It doesn't work when it did a week ago. What is happening????
An IDE is an "Integrated Development Environment" It's basically a program that allows to make other programs. Some include: Visual Studios, Codeblocks, and lots others.
yes...the rest is to find the roots of a function which I don't have a problem with...But my sqrtnum is, as mentioned above, giving me wrong answers...
I'm not sure. What I would do is start putting cout statements all over the place (or you can use asserts) and you might be able to figure it out that way. But honestly I don't know.
Well, you actually don't need to make your own sqrt function. If you add #include <cmath> to the header, than the std library has a built-in square root function called sqrt. You can save all of the headway by just using that instead of trying to... well, create your own.
Reread the first comment by ispil. Look at line 17. You are returning num, the value that you passed into the function. This is not the right thing to return.