I am trying to develop a Complex number calculator. [closed]

If the goal is truly to have a complex number calculator, and not to complete a school assignment or other exercise with some arbitrary restrictions, then you should use std::complex and do not reinvent the wheel.

For what it’s worth, the constructor of std::complex takes two arguments, both with default values. Not mentioning templates, std::complex< double > effectively explicitly defines one constructor:

complex( double real = 0, double imaginary = 0 );

Implementing this should gain the functionality mentioned in the question.

Leave a Comment