鱼C论坛

 找回密码
 立即注册
查看: 3721|回复: 2

c++小问题

[复制链接]
发表于 2012-9-18 22:15:26 | 显示全部楼层 |阅读模式
3鱼币
  1. #include<iostream>
  2. using namespace std;

  3. class Box
  4. {
  5. public:
  6. Box( int, int, int );
  7. int volume();

  8. private:
  9. int height;
  10. int width;
  11. int length;
  12. };

  13. Box :: Box( int h, int w, int l)
  14. {
  15. height = h;
  16. width = w;
  17. length = l;
  18. }

  19. int Box :: volume()
  20. {
  21. return (height * width * length);
  22. }

  23. int mian()
  24. {
  25. Box box1( 1, 3, 5 );
  26. cout << "体积 " << box1.volume () << endl;

  27. Box box2( 2, 5, 8);
  28. cout << "体积 " << box2.volume () << endl;
  29. return 0;
  30. }

复制代码
搜狗截图120918_1.png
刚开始学习C++ ,编了一个程序,,就是求长方体的体积,求教各位鱼油哪里有问题?

最佳答案

查看完整内容

大神~服了你了,main写错了!写成mian了
小甲鱼最新课程 -> https://ilovefishc.com
发表于 2012-9-18 22:15:27 | 显示全部楼层
大神~服了你了,main写错了!写成mian了
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

 楼主| 发表于 2012-9-18 22:27:25 | 显示全部楼层
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2025-11-15 04:40

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表