码迷,mamicode.com
首页 > 其他好文 > 详细

求立方体的体积

时间:2015-02-05 21:58:11      阅读:144      评论:0      收藏:0      [点我收藏+]

标签:

#include<stdio.h>
#include<iostream>
#include<wchar.h>
#include<cstdlib>
#include<iomanip>

using namespace std;
class Box
{
private:
    int h, w, d;
public:
    Box(int , int , int);
    ~Box();
    int volume();
};
Box::Box(int a, int b, int c)
{
    h=a;
    w=b;
    d=c;
}
Box::~Box ()
{
}
int Box::volume ()
{
    return h*w*d;
}
int main()
{
    Box v(1,2,3);    
    int m=v.volume ();
    cout << m<< endl;
}

求立方体的体积

标签:

原文地址:http://blog.csdn.net/cq1042713261/article/details/43535245

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!