**********(a+ib)/(c+jd) ***********
void main(){
float a,b,c,d;
float x,y;
clrscr();
cout<<"\n ENTER THE REAL AND IMAGINARY PART OF 1ST COMPLEX NUMBER : ";
cin>>a>>b;
cout<<"\n ENTER THE REAL AND IMAGINARY PART OF 2ND COMPLEX NUMBER : ";
cin>>c>>d;
cout<<"\n\n THE RESULT IS : ";
if(a==0 && b==0 && c==0 && d==0)
{
x=0;
y=0;
cout<
}
if(d>0 && b>0 && d!=b && a!=c)
{
x = ((a*c)+(b*d))/((c*c)+(d*d));
y = ((a*d)-(b*c))/((c*c)+(d*d));
if(y>0)
{
cout<
}
else if(y<0)
{
cout<
}
}
else if(d<0 && b>0)
{
x = ((a*c)-(b*d))/((c*c)+(d*d));
y = ((a*d)+(b*c))/((c*c)+(d*d));
if(y<0)
{
cout<
}
else
{
cout<
}
}
else if(b<0 && d>0)
{
x = ((a*c)-(b*d))/((c*c)+(d*d));
y = ((a*d)+(b*c))/((c*c)+(d*d));
if(y<0)
{
cout<
}
else
{
cout<
}
}
else if(b<0 && d<0)
{
x = ((a*c)+(b*d))/((c*c)+(d*d));
y = ((a*d)-(b*c))/((c*c)+(d*d));
if(y<0)
{
cout<
}
else
{
cout<
}
}
else if(a==c && b==d)
{
cout<<"1";
}
getch();
return;
}
No comments:
Post a Comment