Home » C++ Programming » Numbers » Question
  1. What is the output of this program?
    #include <iostream>
    #include <complex>
    using namespace std;
    int main()
    {
    complex<double> Comp_double(4, 6);
    complex<int> Comp_int(7, 8);
    Comp_double *= 2;
    Comp_double = Comp_int;
    cout << Comp_double;
    return 0;
    }
    1. (7,8)
    2. (4,6)
    3. (8,7)
    4. (6,4)
    5. None of these
Correct Option: A

We are just copying the value of Comp_int into Comp_double, So it’s printing as (7,8).



Your comments will be displayed only after manual approval.