/*
* Copyright (c) 2015,烟台大学计算机学院
* All right reserved.
*文件名:two week 3.app
* 作者:柴银平
* 完成时间:2015年3月18日
* 版本号:v1.0
*
* 问题描述:根据输入的长方柱类的长宽高,求出体积、表面积。
*程序输入:长方柱类的长宽高。
*程序输出:长方柱类的体积、表面积。
*/
#include <iostream>
using namespace std;
class Bulk
{
private :
double length;
double width;
double heigth;
public :
void get_value();
void display();
};
void Bulk::get_value()
{
cout<<"请输入长宽高:"<<endl;
cin>>length>>width>>heigth;
}
void Bulk::display()
{
cout<<length*width*heigth<<endl;
cout<<length*width*2+length*heigth*2+width*heigth*2;
}
int main()
{
Bulk b1,b2,b3;
b1.get_value();
cout<<"for b1:"<<endl;
b1.display();
cout<<endl;
b2.get_value();
cout<<"for b2:"<<endl;
b2.display();
cout<<endl;
b3.get_value();
cout<<"for b3:"<<endl;
b3.display();
感想:学习还没进入状态的感觉。。。 好可怕!!!