#include
#include
using namespace std;
struct complex//比较复数大小的函数
{
int real;
int imag;
};
int compare(struct complex a,struct complex b)
{
double r,t;
r=sqrt(pow(a.real,2.0)+pow(a.imag,2.0));
t=sqrt(pow(b.real,2.0)+pow(b.imag,2.0));
if(r>t)
{
return 0;//复数a 大则输出0
}
else
{
if(r==t)
{
return 1;//复数相等则输出1
}
else
{
return 2;//复数b 大则输出2
}
}
}
int main()
{
int x,y;
double m,n;
struct complex a,b;
cout
cin>>x;
cout
cin>>y;
if(x>y)
{
cout
}
else
{
if(x==y)
{
cout
}
else
{
cout
}
}
cout
cin>>m;
cout
cin>>n;
if(m>n)
{
cout
}
else
{
if(m==n)
{
cout
}
else
{
cout
}
}
cout
cin>>a.real;
cout
cin>>a.imag;
cout
cin>>b.real;
cout
cin>>b.imag;
if(compare(a,b)==0)
{
cout}
else
{
if(compare(a,b)==1)
{
coutelse
{
cout
}
}
system("pause");
}
#include
#include
using namespace std;
struct complex//比较复数大小的函数
{
int real;
int imag;
};
int compare(struct complex a,struct complex b)
{
double r,t;
r=sqrt(pow(a.real,2.0)+pow(a.imag,2.0));
t=sqrt(pow(b.real,2.0)+pow(b.imag,2.0));
if(r>t)
{
return 0;//复数a 大则输出0
}
else
{
if(r==t)
{
return 1;//复数相等则输出1
}
else
{
return 2;//复数b 大则输出2
}
}
}
int main()
{
int x,y;
double m,n;
struct complex a,b;
cout
cin>>x;
cout
cin>>y;
if(x>y)
{
cout
}
else
{
if(x==y)
{
cout
}
else
{
cout
}
}
cout
cin>>m;
cout
cin>>n;
if(m>n)
{
cout
}
else
{
if(m==n)
{
cout
}
else
{
cout
}
}
cout
cin>>a.real;
cout
cin>>a.imag;
cout
cin>>b.real;
cout
cin>>b.imag;
if(compare(a,b)==0)
{
cout}
else
{
if(compare(a,b)==1)
{
coutelse
{
cout
}
}
system("pause");
}