-
What is the output of this program?
#include <iostream>
#include <complex>
using namespace std;
int main()
{
complex<double> CompNum1(2.0,4.0);
cout << "Complex Number: " << CompNum1;
complex<float> CompNum2(polar(3.0,0.25));
cout << CompNum1 + complex<double>(CompNum2.real(),CompNum2.imag());
return 0;
}
-
- Complex Number: (4.90674,4.74221)(2,4)
- Compilation Error
- Runtime Error
- Complex Number: (2,4)(4.90674,4.74221)
- None of these
Correct Option: D
We are adding the two complex numbers and printing the result.