"Function call missing argument list" ?
"Function call missing argument list"?
#include <iostream>
#include <iomanip>
#define _USE_MATH_DEFINES //needed to include the math constants
#include <math.h>
#include <string> //needed to include texts
using namespace std;
double Volume(double Length, double Width, double Height)
{
double volume;
volume = Length*Width*Height;
return volume;
}
double Area(double Length, double Width, double Height)
{
double area;
area = 2 * Width*Length + 2 * Length*Height + 2 * Height*Width;
return area;
}
void DisplayData(double Length, double Width, double Height, double volume, double area)
{
cout << "For the width " << Width << ", the length " << Length << " and the Height " << Height << "; the volume of the box is " << volume << " and the surface area is " << area << ".";
}
int main()
{
double Length, Width, Height;
cout << "Welcome! This program will calculate the volume and surface area of a box. All this program needs is you to input the length, width and height of the box." << endl;
cout << "Please note that all meausurments are in meters." << endl;
cout << "Please insert a value for the length: " << endl;
cin >> Length;
cout << "Please insert a value for the width: " << endl;
cin >> Width;
cout << "Please insert a value for the height: " << endl;
cin >> Height;
cout << endl;
Volume;
Area;
DisplayData;
return 0;
}//end main
我正在编写一个带有函数的程序,但它给了我标题中的错误。我究竟如何调用函数?我真的不明白那部分。您只是写函数的名称还是涉及其他内容?
我想你应该像这样调用函数
double volume = Volume(Length, Width, Height);
double area = Area(Length, Width, Height);
DisplayData(Length, Width, Height, volume, area);
而不是三个毫无意义的陈述
Volume;
Area;
DisplayData;
函数名称和变量名称相互冲突。编译器将变量视为函数volume
并在其后查找参数。
double volume;
将其更改为
double dVolume;
dVolume = Length*Width*Height;
return dVolume;
也对area
进行类似的更改。
相关文章:
- 使用std::multimap迭代器创建std::list
- 表示"accepting anything for this template argument" C++概念的通配符
- 来自 std::list 的迭代器 .end() 按预期返回"0xcdcdcdcdcdcdcdcd"但 .begin()
- 如何在 C 中正确使用 libiconv 使其不会报告"Arg list too long"?
- C++中带有List类的迭代器Segfault
- 使用"std::unordereded_map"映射到"std::list"对象
- GCC对可能有效的代码抛出init list生存期警告
- 如何修复错误消息,如"argument list for class template is missing"?
- 矩阵类:"No instance of overloaded function push_back matches the argument list"
- C++ "argument list for class template "迭代器" is missing"错误
- 方法定义中的错误"passing const List<int> as this argument discards qualifiers"
- "Function call missing argument list" ?
- 需要帮助理解 GCC 给出"within a nested template argument list"错误的含义
- 这是解决 GCC "sorry, unimplemented: cannot expand ‘NEXT ...’ into a fixed-length argument list"错误的好方法吗?
- "more than one instance of overloaded function " 标准::p ow " matches the argument list"
- MSVC:"use of class template requires template argument list" STL 容器内
- "use of class template requires template argument list"错误,即使使用了模板的模板,因此模板类是预期的
- 模板中的模板:为什么"`>>' should be `> >' within a nested template argument list"
- "use of class template requires template argument list"是什么意思?
- 错误"function call missing argument list" - 帮助为我指明正确的方向