
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
arg() Function for Complex Number in C++
A complex number is a number that is expressed in the form of a + bi, where a and b are real numbers. i is the imaginary part of number.
The argument is the angle between the positive axis and the vector of the complex number. For a complex number
z = x + iy denoted by arg(z),
For finding the argument of a complex number there is a function named arg() of a complex number in the complex header file.
Syntax
arg(complex_number);
Parameter
The function accepts a complex number as input to calculate the value of the argument for that complex number.
Returned value
The function returns the argument of the complex number.
Example
#include<iostream> #include<complex.h> using namespace std; int main (){ double a = 12.0, b = 56.0; complex<double> complexnumber (a, b); cout<<"The argument of complex number "<<a<<" + i"<<b<< " is: "; cout<<arg(complexnumber)<<endl; return 0; }
Output
The argument of complex number 12 + i56 is: 1.3597
Advertisements