fork(5) download
#include <iostream>
#include <complex>

int main()
{
    std::complex<double> a = 3.0;
    std::complex<double> b = 2.0;
    std::complex<double> c = 1.0;

    std::complex<double> d = sqrt(pow(b,2)- 4.0*a*c);
    std::complex<double> r1 = (-b + d)/(2.0*a);
    std::complex<double> r2 = (-b - d)/(2.0*a);
    std::cout << "The answers are " << std::showpos << '\n'
              << r1.real() << " " <<  r1.imag() << "i\n"
              << r2.real() << " " << r2.imag() << "i\n";
}
Success #stdin #stdout 0.02s 2724KB
stdin
Standard input is empty
stdout
The answers are 
-0.333333 +0.471405i
-0.333333 -0.471405i