Pure Programmer
Blue Matrix

Cluster Map

Project: Quadratic Roots

Quadratic equations of the form Ax2 + Bx + C = 0 have two possible solutions given by the [[Quadratic Formula]]. Write a program that sets the constants A = 2, B = 4 and C = 1 then prints the two possible solutions. Then change the constants A, B and C to get solutions to other quadratic equations. Is it possible that this program could fail?

$ g++ -std=c++17 QuadraticRoots.cpp -o QuadraticRoots -lfmt $ ./QuadraticRoots root #1: -0.292893 root #2: -1.70711