- Java 双重比较
- java - 比较器与 Apache BeanComparator
- Objective-C 完成 block 导致额外的方法调用?
- database - RESTful URI 是否应该公开数据库主键?
新用户,编程新手,x 秒的搜索没有找到我的答案。完整代码(不完整 - 以及基本内容的在线测验):
#include "stdafx.h"
#include <iostream>
#include "constant.h"
double towerheight()
{
std::cout << "Input tower height" << std::endl;
double height;
std::cin >> height;
return height;
}
double ballheight(double towerheight)
{
//valid stuff goes here in program, but not applicable to question
}
int main()
{
double towerheight;
towerheight = towerheight(); //Error occurs here
ballheight(towerheight);
return 0;
}
从底部开始的 3 行忽略空格和右括号是发生错误的地方。 (term 不计算为采用 0 个参数的函数。)
我在研究结束时有点迷茫,需要一些人工帮助。
对于可能格式不佳的问题,我们深表歉意。请告知,我可能不知道导致错误的某些术语,我的目标是了解发生了什么。
编辑:
我的解决方案是更改错误上方的 double 变量的名称。为什么这会成为一个问题?
最佳答案
在 main
中,名为 towerheight
的变量隐藏了函数 towerheight
。因此,
towerheight = towerheight();
无效。它类似于对变量调用函数。
double towerheight;
double dummy;
towerheight = dummy();
这就是为什么它不正确。
解决方案一
您可以使用:
double towerheight;
towerheight = ::towerheight();
使用 ::towerheight
是可行的,因为它指的是封闭命名空间中的名称,而不是本地定义的同名变量。
方案二
使用不同的名称。
您可以通过使用两个不同的名称来避免一些混淆。
double t_height = towerheight();
关于c++ - 简单的C++程序错误c2064 : term does not evaluate to a function taking 0 arguments,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34080179/
我遇到了随机森林抛出错误的问题。 我有这个数据框,其中包含已经采用矩阵形式的推文数据,其中包含我试图预测的情绪列。 'data.frame': 1000 obs. of 2155 variabl
在 ansi-term 和 multi-term 中,在我 cd 到一个目录后,我收到一条错误消息和乱码输出,其中 ls 的内容打印但与提示重叠。这是我得到的 $ cd /Users/crippled
我是否必须设置诸如.emacs.d/init_bash.sh之类的东西(对于shell模式),或者它可以读取我的~/.bash_profile直接地?如果是后者,如何设置配置 ansi-term/mu
我有一个类似这样的查询 select city_desc from mst_city where upper(city_desc) like upper('%branch%') 它填充结果以分支开头的
在这里,我试图获取多个术语的搜索结果。说 fulltext="Lee jeans",然后 regexresult={"lee","jeans"}。 代码: IProviderSearchContext
我有一个看起来像这样的方法: public void UpdateTermInfo(List termInfoList) { foreach (Term termInf
With your perfect help here我已经了解了如何计算热门话题(标准分数 + float 平均值)。 我的下一个问题:我的数据库中的术语(由 1-3 个单词组成)与它们被提及的时间
我需要有目的地再创建 2 个表:一个表将存储标签和类别数据(类别可以有层次结构,但标签没有),另一个表存储标签、类别和内容之间的关系。但我对那两张 table 的名称很困惑。我确实是网络开发的新手。经
我在 Elasticsearch 文档 (6.8) 中看到了关于跨度查询的部分, 请求和结果类似于一些术语级别的查询,但它提到跨度是“低级别位置”,闻起来更像是偏好(也许我错了)。 问题是如果我想使用
我在使用 Solr 4.2.0 的“/terms”请求处理程序方面遇到困难。 使用 Web 浏览器,以下 url 返回 fieldName INDUSTRY 的术语列表 http://localhos
我目前正尝试在 elasticsearch 中做一些有趣的事情……而且它几乎可以工作。 用例:我必须将每个特定字段的结果数限制为 (x) 个结果。 示例:在餐厅的结果集中,我只想为每个餐厅名称返回两个
在 term.el ,我们可以从一种子模式更改为另一种子模式。但是,有没有办法用一个功能(和一个键绑定(bind))在它们之间切换? 另一个问题:有没有办法在term-char-mode 中用键盘标记
我有一个按以下顺序列出的员工姓名和薪水列表 我需要按以下格式创建输出表。即,每当累计工资总额超过 3000 时,我必须检测到并标记该行。 我试图做 row_cumsum 并在它超过 3000 时重置
当使用 eshell 或 ansi-term 和 bash emacs 时,会根据您所在的目录更改默认目录变量。 因此,如果我移动到 /home/user/code/project,然后使用 ido-
我可以在我的数据集上使用 R 包“e1071”运行 svm,但我无法使用任何两个预测变量绘制图形。即使谷歌搜索了很多,我也无法找到它的解决方案。请高手帮我解决这个问题: 我有一个具有以下属性的数据集:
Term::ReadLine::Stub::new(/usr/lib/perl5/5.8.8/Term/ReadLine.pm:243): 我期待看到Term::ReadLine::new ,这通常是
我要搜索这个: Post Cereal 得到这个: Post Honey Nut Cereal 通配符是空格。 我知道我可以执行 SPLIT 和一系列 AND 和 Contains() 并将每个术语作
我想根据聚合数据在换句话说过滤数据中放置一个条件。 目前,我有一个查询 GET sense/_search { "size": 0, "aggs": { "dates": {
我在一个围绕化学式的项目上遇到了麻烦。我有两个类(class),Term 和 Formula。 Term 接收诸如“H”或“C2”之类的输入 - 只有一个字母和任意数量的后续数字。它的字段是 elem
我尝试使用 boost::numerics::odeint 来积分微分方程组。我的代码是 dMat Equation::solveODE(dMat u_i, double t_i) { dVec u_
我是一名优秀的程序员,十分优秀!