error: invalid operands of types ‘double’ and ‘double’ to binary ‘operator^’

来源:互联网 发布:淘宝上怎么搜索gta5 编辑:程序博客网 时间:2024/05/17 08:07

今天在编译 g++ test.cpp -o test 时候,系统老提示

test.cpp: In function ‘int main()’:

test.cpp:122: error: invalid operands of types ‘double’ and ‘double’ to binary ‘operator^’
test.cpp:123: error: invalid operands of types ‘double’ and ‘double’ to binary ‘operator^’
test.cpp:139: error: invalid operands of types ‘double’ and ‘double’ to binary ‘operator^’

test.cpp:140: error: invalid operands of types ‘double’ and ‘double’ to binary ‘operator^’


这句话有问题,C++没有强大到A^2=A*A

dfaOutputXY[uiXX][uiYY].x=-(double)(sqrt(dfRadius^2-(ADOutputY[uiYY])^2))*((double)cos(dfTMP1));

改正后:

dfaOutputXY[uiXX][uiYY].x = -sqrt(dfRadius*dfRadius-ADOutputY[uiYY]*ADOutputY[uiYY])*cos(dfTMP1);

编译通过~~~


0 0
原创粉丝点击