#include<stdio.h>
#include<math.h>
double e(double *u,double *v)
{
*u=exp(*u)*cos(*v);
*v=exp(*u)*sin(*v);
return ;
}
double ln(double *u,double *v)
{
*u=ln(sqrt((*u)*(*u)+(*v)*(*v)));
*v=atan((*v)/(*u));
return;
}
double sin(double *u,double *v)
{
*u=sin(*u)*(exp(*v)+exp(-(*v)))/2;
*v=cos(*u)*(exp(*v)-exp(-(*v)))/2;
return;
}
double cos(double *u,double *v)
{
*u=cos(*u)*(exp(*v)+exp(-(*v)))/2;
*v=-sin(*u)*(exp(*v)-exp(-(*v)))/2;
return;
}
main()
{
double x,y,a,b;
double e(double *,double *);
double ln(double *,double *);
double sin(double *,double *);
double cos(double *,double *);
printf("请输入复数的实部和虚部x,y:");
scanf("%lf%lf",&x,&y);
a=x;b=y;
e(&x,&y);
printf("exp(%f+%fi)=%f+%fi\n",a,b,x,y);
x=a;y=b;
ln(&x,&y);
printf("ln(%f+%fi)=%f+%fi\n",a,b,x,y);
x=a;y=b;
sin(&x,&y);
printf("sin(%f+%fi)=%f+%fi\n",a,b,x,y);
x=a;y=b;
cos(&x,&y);
printf("cos(%f+%fi)=%f+%fi\n",a,b,x,y);
}
问题如下:
1,错误 16 error C2198: “cos”: 用于调用的参数太少
2,错误 2 error C2440: “函数”: 无法从“double”转换为“double *”
( 21 IntelliSense: "double" 类型的实参与 "double *" 类型的形参不兼容 )
3, 警告 13 warning C4029: 声明的形参表不同于定义
4,警告 1 warning C4033: “e”必须返回值
不明白这是为什么,希望高手指点。