conj() function in C++ with Examples Last Updated : 11 Jul, 2025 Comments Improve Suggest changes 1 Likes Like Report The conj() function is defined in the complex header file. This function is used to find the conjugate of the complex number z. If we represent a complex number z as (real, img), then its conjugate is (real, -img).Syntax: template<class T> complex<T> conj (const complex<T>& Z);Parameter: z: This method takes a mandatory parameter z which represents the complex number.Return value: This function returns the conjugate of the complex number z.Time Complexity: O(1)Auxiliary Space: O(1)Below programs illustrate the conj() function for complex number in C++:Example 1:- CPP // C++ program to demonstrate // example of conj() function. #include <bits/stdc++.h> using namespace std; // driver program int main () { complex<double> complexnumber (3.0, 2.4); cout << "The conjugate of " << complexnumber << " is: "; // use of conj() function cout << conj(complexnumber) << endl; return 0; } OutputThe conjugate of (3,2.4) is: (3,-2.4)Example 2:- CPP // C++ program to demonstrate // example of conj() function. #include <bits/stdc++.h> using namespace std; // driver program int main () { complex<double> complexnumber (2.0, 9.0); cout << "The conjugate of " << complexnumber << " is: "; // use of conj() function cout << conj(complexnumber) << endl; return 0; } OutputThe conjugate of (2,9) is: (2,-9) Create Quiz Comment B bansal_rtk_ Follow 1 Improve B bansal_rtk_ Follow 1 Improve Article Tags : Misc C++ CPP-Library cpp-math Explore C++ BasicsIntroduction to C++3 min readData Types in C++6 min readVariables in C++4 min readOperators in C++9 min readBasic Input / Output in C++3 min readControl flow statements in Programming15+ min readLoops in C++7 min readFunctions in C++8 min readArrays in C++8 min readCore ConceptsPointers and References in C++5 min readnew and delete Operators in C++ For Dynamic Memory5 min readTemplates in C++8 min readStructures, Unions and Enumerations in C++3 min readException Handling in C++12 min readFile Handling in C++8 min readMultithreading in C++8 min readNamespace in C++5 min readOOP in C++Object Oriented Programming in C++8 min readInheritance in C++6 min readPolymorphism in C++5 min readEncapsulation in C++3 min readAbstraction in C++4 min readStandard Template Library(STL)Standard Template Library (STL) in C++3 min readContainers in C++ STL2 min readIterators in C++ STL10 min readC++ STL Algorithm Library3 min readPractice & ProblemsC++ Interview Questions and Answers1 min readC++ Programming Examples4 min read Like