CS2064 "term does not evalute a function taking 1 argument" ?
CS2064 "term does not evalute a function taking 1 argument"?
我看过其他线程,他们说"这个或那个不是指针!!"我真的不知道这是什么意思,我已经声明了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)将是该函数的一个参数。
相关文章:
- "error: no matching function for call to"构造函数错误
- 调用专用模板时出错"no matching function for call to [...]"
- 库函数需要一个 std::function<void(void)>,如何传入类函数?
- Confusion: decltype vs std::function
- 为什么 std::function 可以作为 std::not2 的参数?
- 'max'匹配'std::function<const int &(const int &, const int &)>'无过载
- 传递给std::function template的template参数究竟代表什么
- 将带有unique_ptr的可变 lambda 传递给 const&std::function
- 绑定派生类方法C++从实例范围之外的分隔 std::function 变量调用
- "no matching function for call to 'Vector::Vector'"错误
- 如何在向量中删除 std::function<void()>?
- 不断"Attempting to reference a deleted function"
- 将函数包装器转换为 std::function
- 类型擦除的std::function与虚拟函数调用的开销
- C++ std::function 对于类 exept 的所有实例都是空的(只有 Visual2019 编译器问题)
- 如果模板没有可变参数,则 Lambda 被推导出为 std::function
- 我在 ifstream input_file(文件名)行中收到错误"no matching function to call";
- "term does not evaluate to a function taking 0 arguments"错误
- 标准::平等给出"Term doesnt evaluate to a function taking 2 arguments"
- CS2064 "term does not evalute a function taking 1 argument" ?