CS2064 "term does not evalute a function taking 1 argument" ?

CS2064 "term does not evalute a function taking 1 argument"?

本文关键字:taking function argument evalute term does not CS2064      更新时间:2023-10-16

我看过其他线程,他们说"这个或那个不是指针!!"我真的不知道这是什么意思,我已经声明了var s那么这里有什么问题呢?我们正在写一个程序来求一个正方形的面积顺便说一下,这也不是全部的代码!第2行也是错误指向的地方。

int s = ((line_one + line_two + line_three) / 2);
    int area = sqrt((s - line_one)(s - line_two)(s - line_three));
    cout << "The area of the triange is..." << area << endl;

这里是我声明其他变量的地方:

// Area of a Triangle
double x1 = 0;
double y1 = 0;
double x2 = 0;
double y2 = 0;
double x3 = 0;
double y3 = 0;
double x4 = 0;
double y4 = 0;
double x5 = 0;
double y5 = 0;
double x6 = 0;
double y6 = 0;
//line one points
cout << "enter point x1" << endl;
cin >> x1;
cout << "enter point y1" << endl;
cin >> y1;
cout << "enter point x2" << endl;
cin >> x2;
cout << "enter point y2" << endl;
cin >> y2;
const int line_one = sqrt((pow((x2 - x1), 2) + (pow((y2 - y1), 2))));
//line two points
cout << "enter point x3" << endl;
cin >> x3;
cout << "enter point y3" << endl;
cin >> y3;
cout << "enter point x4" << endl;
cin >> x4;
cout << "enter point y4" << endl;
cin >> y4;
const int line_two = sqrt((pow((x4 - x3), 2) + (pow((y4 - y3), 2))));
//line three points
cout << "enter point x5" << endl;
cin >> x5;
cout << "enter point y5" << endl;
cin >> y5;
cout << "enter point x6" << endl;
cin >> x6;
cout << "enter point y6" << endl;
cin >> y6;
const int line_three = sqrt((pow((x6 - x5), 2) + (pow((y6 - y5), 2))));
//Calculating the Area
int s = ((line_one + line_two + line_three) / 2);
int area = sqrt((s - line_one)(s - line_two)(s - line_three));
    cout << "The area of the triange is..." << area << endl;

return 0;
}

这是一个很容易犯的错误,您忘记在sqrt()函数调用中要乘的东西之间添加*。

int s = ((line_one + line_two + line_three) / 2);
    int area = sqrt((s - line_one)*(s - line_two)*(s - line_three));
    cout << "The area of the triange is..." << area << endl;

。它给你指针错误,因为它认为你试图调用一个函数,例如,(s- line_one)将返回一个函数指针,(s-line_two)将是该函数的一个参数。