第2周初见对象--长方体

/*  
 * Copyright (c) 2015, 烟台大学计算机学院  
 * All rights reserved.  
 * 文件名称:test.cpp  
 * 作    者:姜甜甜
 * 完成日期:2015年 3 月 13 日  
 * 版 本 号:v1.0  
 *  
 * 问题描述:有一个圆型的旱冰场地,场地内抹水泥,造价为每平方米M元,围栏用木条围成,每米造价N元,输入旱冰场半径,用程序计算出其造价;
 * 输入描述:输入半径r ;
 * 程序输出:输出总造价。
#include <iostream>
using namespace std;
class Bulk
{
private:
    double length;
    double width;
    double heigth;
public:
    void volume();
    void areas();
    void set_in();
};
void Bulk::volume()
{
    cout<<"体积是:"<<length*width*heigth<<endl;
}
void Bulk::areas()
{
    cout<<"周长是:"<<2*(length*width+length*heigth+width*heigth)<<endl;
}
void Bulk::set_in()
{
    cin>>length>>width>>heigth;
}
int main()
{
    Bulk t1,t2,t3;
    t1.set_in();
    t1.volume();
    t1.areas();
    t2.set_in();
    t2.volume();
    t2.areas();
    t3.set_in();
    t3.volume();
    t3.areas();
    return 0;
}


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值