标题:[求助]新手求助,还望各位指点一下。谢谢。
取消只看楼主
anoldyan
Rank: 1
等 级:新手上路
帖 子:28
专家分:0
注 册:2007-9-11
 问题点数:0 回复次数:1 
[求助]新手求助,还望各位指点一下。谢谢。

这次我真的不清楚问题出在哪儿了。

//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 ,而且提示出错的地方是倒数第四行的{

搜索更多相关主题的帖子: default include equals values 
2007-11-02 23:23
anoldyan
Rank: 1
等 级:新手上路
帖 子:28
专家分:0
注 册:2007-9-11
得分:0 
谢谢各位的指点!看来书上的东西也不能完全照搬。
2007-11-05 09:18



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-183042-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.229266 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved