imag() in C++

imag(): This function is available in the file complex. This function returns the imaginary part of the complex number. It takes one argument as a complex number.

Parameters: One parameter is required for this function.

__X: The complex number whose imaginary part is to be determined.

Syntax:

imag(__X)

For Example:

complexNum (12,10)

imag(complexNum) = > It returns 10.

Approach

C++

#include <bits/stdc++.h>
using namespace std;

int main()
{
    complex<doublecomplexNum(1210);

    cout << imag(complexNum<< "\n";

    return 0;
}

No comments:

Post a Comment