Trinomial factoring
| Geralds mod (26) | |||
| I hate doing trinomials in class. The only way they taught us how to do them was guess and check. (A trinomial looks like this: ax^2 + bx + c) I made a C++ app that factors them into (x + )(x - ) form, and it also gives you the answers to X. It only works with trinomials that look like this: ax^2 + bx +c Or ones that look like: ax^2 + c This kind doesn't work at this time: ax^3 + bx + c I would really appreciate it if someone could compile it and test a few trinomials in it. If there is a bug just say so. I might be able to fix it myself. Trinomial factoring source code:
Thanks. | |||
| magicalblender (82) | |||
| cmath conveniently has a its own square root function, which may be more accurate than yours. Try it out. It's called sqrt(). Near the end of your program, you write:
cout << "\x1b[2J\x1b[H" << flush;What is the purpose of this line? Other than that, this seems quite functional. Well done. :-) EDIT: Found a bug- when a,b, and c equal zero, it hangs. I suspect the problem is with gcd(). | |||
| Geralds mod (26) | |||
I made my own square root because sqrt was giving me problems. Something about it must be a double.
cout << "\x1b[2J\x1b[H" << flush;That just clears the screen. If your factoring a trinomial A,B and C will not equal 0. | |||
This topic is archived - New replies not allowed.
