ที่นี่เราจะดูเมธอด atan() สำหรับจำนวนเชิงซ้อน จำนวนเชิงซ้อนสามารถใช้ได้ผ่าน header file complex ใน header file นั้น ฟังก์ชัน atan() ก็อยู่ด้วย นี่คือ complex version ของ atan() ธรรมดา ใช้หา complex arc tan ของจำนวนเชิงซ้อน
ฟังก์ชันนี้รับจำนวนเชิงซ้อนเป็นพารามิเตอร์อินพุต และคืนค่า arc tan เป็นเอาต์พุต มาดูตัวอย่าง
ตัวอย่าง
#include<iostream>
#include<complex>
using namespace std;
int main() {
complex<double> c1(5, 2);
// atan() function for complex number
cout << "The atan() of " << c1 << " is " << atan(c1);
}
ผลลัพธ์
The atan() of (5,2) is (1.39928,0.067066)