函数声明符后面应为函数体
Expected function body after function declarator
不确定错误持续存在的位置,在我的for循环中包含if语句时遇到问题
bool operator<=(string a, const Zoo& z)
// Pre: none
// Post: returns true if animal a is in Zoo z.
// the owner does not count as an animal.
for ( int i=0; i< z.count-1; i++ ) {
if (z.cage[z.count-1] == a){
return true;
}
else {
return false;
}
}
您忘记在函数体的开头放一个括号{
。
相关文章:
- 用C++在单独的头文件中完成函数体
- 我可以在 C++ 中的函数体之外进行操作吗?
- 如何在C++函数中声明静态 2D 数组?
- 为什么在我的 main 函数中声明整数后我的整数数组中会出现错误?
- 有没有办法在不使用 #ifdef 的情况下不编译发布版本中的单元测试函数体?
- binary_search() 函数在我的函数体中不起作用
- 如何显示函数开始、结束行和函数体?
- 在函数中声明的 ifStream 对象在发布模式下不起作用
- 函数指针声明
- C++函数的声明和定义不同,但它运行良好
- 当我尝试在函数内声明一个函数时,它不起作用?有什么建议吗?*源代码如下*
- 何时在函数中声明堆栈分配变量?
- 主函数体未检测到对重载可变变量模板化函数C++的调用
- C++:为什么允许在另一个函数中声明函数,而不允许在函数定义中声明?
- 我们可以在main函数中声明嵌套类对象吗
- 错误:函数声明符之后的预期函数体
- 在其他函数体中声明函数方法的用例是什么
- 函数声明符后面应为函数体
- 在处理模板时,如何避免在函数头和函数体中两次声明相同的类型
- 对函数体中声明的名称进行非限定名称查找