What will be the output of the following C++ code? [code] #include <iostream> #include <complex> using namespace std; int main() { complex

What will be the output of the following C++ code?
Code:
#include <iostream>
#include <complex>
using namespace std;
int main()
{
	complex <double> cn(3.0, 4.0);
	cout<<"proj"<<cn<<" : "<<proj(cn)<<endl;
	return 0;
}
A. proj(3,4) : (3,4)
B. proj(3,4) : (4,3)
C. proj(3,4) : (-3,-4)
D. proj(3,4) : (-3,4)
 
Answer: a
Explanation: In this program we are trying to calculate the projection of a complex number complex(3,4) using proj() function of <complex> header the answer to which is (3,4).
 

Tìm kiếm

Back
Top