Pure Programmer
Blue Matrix


Cluster Map

Project: Cubic Roots

Cubic equations of the form Ax3 + Bx2 + Cx + D = 0 have three possible solutions given by the [[Cubic Formula]]. Write a program that sets the constants A = 1, B = -6, C = 11 and D = -6 then prints the three possible solutions. Then change the constants A, B, C and D to get solutions to other quadratic equations. Is it possible that this program could fail?

Output
$ swiftc CubicRoots.swift -I . -L . -lUtils error: link command failed with exit code 1 (use -v to see invocation) ld: library not found for -lUtils clang: error: linker command failed with exit code 1 (use -v to see invocation)

Solution