What will be the output of the following C++ code?
#include <iostream>
#include <complex>
using namespace std;
int main ()
{
complex<double> mycomplex (20.0, 2.0);
cout << imag(mycomplex) << endl;
return 0;
}
#include <iostream>
#include <complex>
using namespace std;
int main ()
{
complex<double> mycomplex (20.0, 2.0);
cout << imag(mycomplex) << endl;
return 0;
}A. 2
B. 20
C. 40
D. 30
Answer: Option A

Join The Discussion