#include <iostream>
#include <complex> // <-- good work C++, I'd forgotten
etc
So there we go, apply the sqrt() function and we get a result, and the result is as totally expected, not another function. Tada ...
(I'll have to check, but it still looks as though it produces only the principal root, keeping in mind complex roots don't surrender to that name convention very well at all because the concept of +ve and -ve is somewhat lost with them)
One small note: the principal square root is actually one-to one (but not onto). It is defined for all complex numbers, but is discontinuous at all negative numbers and zero.
Try this on your calculator:
sqrt(−4−0.001×i)
output: 0.00025+2.000000016i
now try this:
sqrt(−4+0.001×i)
output: 0.00025−2.000000016i
As you can see, for small differences of the argument (the two inputs differ by 0.002i) you get a big difference in the output (the two output differ by almost 4i).