Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Need help with this little program
#7
(01-18-2012, 08:53 AM)AceInfinity Wrote: You don't know about the square root methods in C++ or you're just having issues with it in any updated code so far?

What are you talking about C++ doesn't support Minus sign with a variable though??? Huh

Make sure your variable definitions have the "signed" attribute... and not "unsigned"

Edit: I may not be able to help with the equation, but I can help you with the coding if I know what you want to do. Been a while since I used that equation for anything, so I don't quite understand how it's used. But I can tell you how to get certain variables from that equation in code.
Hmm try this line instead of all the clutter you've got going on, i've put the formula all into one line:
Code:
x = (-b + sqrt(pow(b, 2) - (4 * a * c))) / (2 * a);

pow from math.h takes a double as input as well, not int.

Can't test as I have no idea of what kind of valid numbers would go into the equation however. You're last bit of the equation seems to have been right, just not sure where that 1 came in when you had it in your code... If it's not working, just reply with what happens at runtime with this. Or provide me with some valid numbers that can be used for this equation that I can fool around with. Smile

Actually, I used the one line code that you have quoted but was the same error.
I now realize that the problem is not in code, it is in the combination of number I input to the program

Thanks for your brilliant time that you gave me

[url=http://myurl.pk/BLgzA][/url]
Reply


Messages In This Thread
Need help with this little program - by Clones - 01-17-2012, 03:22 AM
RE: Need help with this little program - by Clones - 01-21-2012, 08:30 AM

Forum Jump:


Users browsing this thread: 4 Guest(s)