cjlmcxw 发表于 2008-12-24 09:13:17

请大家看下问题在那里?

请大家看下错在那里

求x的反正切值

#define pi3.1415926
#include <math.h>
doublex;
D_L=atan(x)*double(180)/pi;

运行后提示错误如下:
chong.c - 3 errors
1130, 22 Illegal expression.
1130, 28 Found 'int' expected a function.
1130, 33 Operands of * have illegal types 'double' and 'void'

cpubbs 发表于 2008-12-24 09:26:42

记得这是要加分号在后面吧兄弟?
#define pi3.1415926;

cpubbs 发表于 2008-12-24 09:27:38

D_L=atan(x)*double(180)/pi;
改成这样试试
D_L=atan(x)*((double)(180/pi));

cpubbs 发表于 2008-12-24 09:27:45

或者压缩上来,大家一起查查!

cjlmcxw 发表于 2008-12-24 10:58:09

设X=1,
运行
      D_L=atan(x)*((double)(180/pi));后
      D_L=31.82
按理应D_L=45吧

cjlmcxw 发表于 2008-12-24 11:14:00

设X=1,
运行
      D_L=atan(x)*((double)(180/pi));后
      D_L=31.82
按理应D_L=45度 吧

netcreature 发表于 2008-12-24 12:26:50

本帖最后由 netcreature 于 2008-12-24 14:29 编辑

#define pi 3.1415926

double x;
double D_L;
x=1.0;
D_L=atan(x)*180/pi;

测试返回值为:45.00
不知道你为什么会出现这种情况?
页: [1]
查看完整版本: 请大家看下问题在那里?