Numbers
- 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;
}
-
View Hint View Answer Discuss in Forum
NA
Correct Option: A
We are just copying the value of Comp_int into Comp_double, So it’s printing as (7,8).
- What is the output of this program?
#include <iostream>
#include <complex>
using namespace std;
int main()
{
complex<double> Comp1(3.0, 9.0), Comp2;
Comp2 = pow(Comp1, 2.0);
cout << Comp2;
return 0;
}
-
View Hint View Answer Discuss in Forum
NA
Correct Option: D
In this program, we are finding the square of the complex number.
- How many real types are there in complex numbers?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: B
There are three real types in complex numbers. They are float complex, double complex, long double complex.
- How to declare the complex number?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: A
We can declare the complex number by using complex(5,6) where 5 is a real number and 6 is imaginary part.
- Which header file is used to declare the complex number?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: C
complex