Solve the Quadratic equation using C++

This program will solve quadratic equations.
You can copy and paste it into an editor, save it and compile from there.I have compiled and run this on a RedHat GNU/Linux machine using kernel 2.4.20-6 and it works. If you are using another system ( windows or mac you may need to change the coding ).
To compile: name it quadsolv.cpp then type < g++ -o quadsolv quadsolv.cpp > (not the < or the >) then hit enter. When your command prompt returns type < ./quadsolv > and hit enter then follow the directions.

You may need to use math.h like this: #include if you are using windows C++ programming software. (I tried it without the math.h and got an “undeclared identifier” error)

Thanks to “Shahi” for pointing out some errors in my coding. I have fixed them.

update 2005-03-24: added math.h. The program would not compile on Fedora core 3 without adding this.
Compiled ok on my machine after adding math.h again ( gcc -dumpversion 3.4.2 ; Fedora core 3 )

uname -a: Linux 2.6.9-1.667 #1 Tue Nov 2 14:41:25 EST 2004 i686 i686 i386 GNU/Linux

Leave a Reply