第5周项目4 长方柱类

来源:互联网 发布:mac怎么使用搜狗输入法 编辑:程序博客网 时间:2024/05/21 11:26
/*  *copyright(c) 2016,烟台大学计算机学院  *All rights reserved  *文件名称:test.cpp  *作者:李硕  *版本:v6.0  *  *问题描述:宣告主权  *输入描述:  *程序输出: */#include <iostream>using namespace std;class Bulk{public:    void putin();    void volume()    {        cout<<"volume is:"<<length*width*heigth<<endl;    }    void areas()    {        cout<<"areas is:"<<length*width*2+length*heigth*2+width*heigth*2<<endl;    }private:    double length;    double width;    double heigth;};void Bulk::putin(){    cin>>length>>width>>heigth;}int main( ){    Bulk b1,b2,b3;    b1.putin();    b2.putin();    b3.putin();    b1.areas();    b1.volume();     b2.areas();    b2.volume();     b3.areas();    b3.volume();    return 0;}
<img src="http://img.blog.csdn.net/20160402145234494?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQv/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center" alt="" />

0 0
原创粉丝点击