C 99 – Complex.h header file ( Part-1 ) basic macro in c language in hindi , C99 में हैडर फाइल Complex.h क्या है

C99 में हैडर फाइल Complex.h क्या है , C 99 – Complex.h header file basic macro ( Part-1 ) in c language in hindi :-
अगर macro constant_STDC_NO_COMPLEX define होता है और complex.h और इसके function को define होता तो प्रोग्राम मे error आ जाती है |
अतः C 99 मे complex number math perform हो सकती है लेकिन complex number तीन प्रकार के होते है :-
1. complex_float : इसमें complex number float type होता है |
2. complex_double: इसमें complex number double type होता है |
3. long double complex : इसमें complex number long double type का होता है |
इसके अलावा imaginary part को भी include करना होता है |
1.imaginary float : इसमें complex number  का imaginary part float type होता है |
2.imaginary double: इसमें complex number  का imaginary part  double type होता है |
3.long double imaginary : इसमें complex number  का imaginary part  long double type का होता है |
जब complex.h को प्रोग्राम मे include करते है तब तीन प्रकार के imaginary number को access कर सकते है |इसके अलावा standard airthmatic operation भी include होते है |
1. addition
2.subtraction
3.multiplication
4.division
complex.h के macro :
1.complex
इस macro का use किसी complex number  को contain करने के लिए किया जाता है |इसका syntax है :-
_complex ;
ये तीन प्रकार के होते है :
1.complex  float : इसमें complex number , float type का  होता है |इसका syntax होता है :-
     float_complex;
2.complex  double: इसमें complex number , double type  का होता है |इसका syntax होता है :-
     double_complex ;
3.long double complex  : इसमें complex number का type, long double type का होता है | इसका syntax होता है :-
     long double_complex ;
2.imaginary
इस macro का use किसी complex number के imaginary पार्ट  को contain करने के लिए किया जाता है |इसका syntax है :-
_imaginary ;
ये तीन प्रकार के होते है :
1.imaginary float : इसमें complex number  का imaginary part float type होता है |इसका syntax होता है :-
     float_imaginary;
2.imaginary double: इसमें complex number  का imaginary part  double type होता है |इसका syntax होता है :-
     double_imaginary;
3.long double imaginary : इसमें complex number  का imaginary part  long double type का होता है | इसका syntax होता है :-
     long double_imaginary;
उदाहरण के लिए :
#include<stdio.h>
#include<conio.h>
#include<complex.h>
void main()
{
float real;
float_imaginary i= 23*I;
printf(“Enter real part of complex number “);
scanf(“%.1f”,&real);
double complex y=real+i;
printf(“y= %f + %f i”,creal(y),cimg(y));
getch();
}
इस उदाहरण मे , यूजर से real पार्ट को input करा लेते है | और imaginary part को float_imaginary macro के साथ variable i मे assign करा देते है | और complex number को double_complex मे assign करा देते है |
आउटपुट होगा :
Enter real part of complex number 1.2
y= 1.2+ 23 i
3.Complex number related function
3.1-Define complex number
इस macro ,complex number के expression को define करता है |जिसमे complex number के value को complex type मे store किया जाता है और इस complex number के real part को ,complex number के real मे assign किया जाता है और imaginary part को complex number के imaginary type मे store करता है |इसके syntax होते है :-
1.CMPLXF (float real ,float imaginary); इस macro का use ,float type complex number के लिए किया जाता है |
2.CMPLX (double real ,double imaginary); इस macro का use , double type complex number के लिए किया जाता है |
3.CMPLXL (long double real ,long double imaginary ); इस macro का use , long double complex number के लिए किया जाता है |
इसमें दो parameter pass किया जाता है |
1.real part of complex number
2.imaginary part of complex number
इस macro statement से complex number return होती है |
उदाहरण के लिए :
#include<stdio.h>
#include<conio.h>
#include<complex.h>
void main()
{
float real;
float imag;
printf(“Enter real part of complex number “);
scanf(“%.1f”,&real);
printf(“Enter imaginary part of complex number “);
scanf(“%f”,&imag);
y=CMPLXF (real , imag);
printf(“y= %f + %f i”,creal(y),cimg(y));
getch();
}
आउटपुट होगा :
Enter real part of complex number 1.2
Enter imaginary part of complex number 2.3
y= 1.2+ 2.3 i
3.2-Define real part of complex number
इस macro ,complex number के real part को access  लिया जता  है |ये तीन प्रकार के होते है |इसके syntax होते है :-
1.crealf (float complex number ); इस macro का use ,float type complex number के लिए किया जाता है |complex number से real part को access किया जा सकता है |
2.creal(double complex number ); इस macro का use , double type complex number के लिए किया जाता है |
3.creall(long double complex number); इस macro का use , long double complex number के लिए किया जाता है |
इस macro statement मे , complex number को pass किया जाता है | और उस complex number के real पार्ट को access किया जा सकता है |
3.3- Access imaginary part of complex number
इस macro ,complex number के imaginary part को access  लिया जता  है |ये तीन प्रकार के होते है |इसके syntax होते है :-
1.cimagf (float complex number ); इस macro का use ,float type complex number के लिए किया जाता है |complex number से imaginary part को access किया जा सकता है |
2.cimag(double complex number ); इस macro का use , double type complex number के लिए किया जाता है |
3.cimagl(long double complex number); इस macro का use , long double complex number के लिए किया जाता है |
इस macro statement मे , complex number को pass किया जाता है | और उस complex number के real पार्ट को access किया जा सकता है |
3.4 Calculate magnitude of complex number
इस macro ,complex number का magnitude/modules को calculate करने के  लिया जता  है |ये तीन प्रकार के होते है |इसके syntax होते है :-
1.cabsf (float complex number ); इस macro का use ,float type complex number के लिए किया जाता है |complex number का magnitude/modules को calculate करने के  लिया जता  है |
2.cabs(double complex number ); इस macro का use , double type complex number के लिए किया जाता है |
3.cabsl(long double complex number); इस macro का use , long double complex number के लिए किया जाता है |
इस macro statement मे , complex number को pass किया जाता है | और complex number का magnitude को calculate करने के लिए किया जाता है |
उदाहरण के लिए
#include<stdio.h>
#include<conio.h>
#include<complex.h>
void main()
{
float real;
float imag;
float magnitude;
printf(“Enter real part of complex number “);
scanf(“%.1f”,&real);
printf(“Enter imaginary part of complex number “);
scanf(“%f”,&imag);
y=CMPLXF (real , imag);
magnitude = cabsf ( y );
printf(“y= %f + %f i”,creal(y),cimg(y));
printf(“Real Part of complex number = %f”,crealf(y));
printf((“Imaginary Part of complex number = %f “, cimag (y));
printf(“Magnitude of complex number = %f “,magnitude );
getch();
}
आउटपुट होगा :
Enter real part of complex number 5
Enter imaginary part of complex number 7.6
y= 5+ 7.6 i
Real Part of complex number = 5
Imaginary Part of complex number = 7.6
Magnitude of complex number=9.097252
3.5.Calculate phase angel of complex number
इस macro ,complex number का phase angel  को calculate करने के  लिया जता  है |ये तीन प्रकार के होते है |इसके syntax होते है :-
1.cargf (float complex number ); इस macro का use ,float type complex number के लिए किया जाता है |complex number का phase angel को calculate करने के  लिया जता  है |
2.cargf (double complex number ); इस macro का use , double type complex number के लिए किया जाता है |
3.cargl (long double complex number); इस macro का use , long double complex number के लिए किया जाता है |
इस macro statement मे , complex number को pass किया जाता है | और complex number का phase angel को calculate करने के लिए किया जाता है |
3.6-Calculate conjugate of complex number
इस macro ,complex number का conjugate  को calculate करने के  लिया जता  है |ये तीन प्रकार के होते है |इसके syntax होते है :-
1. conjf(float complex number ); इस macro का use ,float type complex number के लिए किया जाता है |complex number का conjugate को calculate करने के  लिया जता  है |
2.conj (double complex number ); इस macro का use , double type complex number के लिए किया जाता है |
3. conjl(long double complex number); इस macro का use , long double complex number के लिए किया जाता है |
इस macro statement मे , complex number को pass किया जाता है | और complex number का conjugate  को calculate करने के लिए किया जाता है |
उदाहरण के लिए :
#include<stdio.h>
#include<conio.h>
#include<complex.h>
void main()
{
float real;
float imag;
float magnitude;
float phase ;
float complex con;
printf(“Enter real part of complex number “);
scanf(“%.1f”,&real);
printf(“Enter imaginary part of complex number “);
scanf(“%f”,&imag);
y=CMPLXF (real , imag);
magnitude = cabsf ( y );
phase= cargf ( y );
con= conjf( y );
printf(“y= %f + %f i”,creal(y),cimg(y));
printf(“Magnitude of complex number = %f  \n”,magnitude );
printf(“Phase angel of complex number = %f \n “, phase);
printf(“conjugate of y \n y*= %f + %f i”,creal(con),cimg(con));
getch();
}
आउटपुट होगा :
Enter real part of complex number 5
Enter imaginary part of complex number 7.6
y= 5+ 7.6 i
Magnitude of complex number = 9.07
Phase angel of complex number = 1.52
conjugate of y
y*= 5 – 7.6 i
इसके अलावा complex .h मे कई और macro include होते है | जिसे C 99 – Complex.h header file  ( Part-2 ) मे पढेगे |