|
这次我真的不清楚问题出在哪儿了。
//Listing 5.7 - demonstrates use
//of default parameter values
#include <iostream>
int AreaCube(int length,int width = 25,int height = 1);
int main()
{
int length = 100;
int width = 50;
int height = 2;
int area;
area = AreaCube(length,width,height);
std::cout << "First area equals:" << area << "\n";
area = AreaCube(length,width);
std::cout << "Second time area equals:" << area << "\n";
area = AreaCube(length);
std::cout << "Third time area equals:" << area << "\n";
char response;
std::cin >> response;
return 0;
}
AreaCube(int length,int width,int height)
{
return (length*width*height);
}
编译提示: ISO C++ forbids declaration of `AreaCube' with no type ,而且提示出错的地方是倒数第四行的{ |
|