求长方体的体积C++代码

来源:互联网 发布:淘宝联盟 返利网 编辑:程序博客网 时间:2024/04/28 09:46
#include<iostream>using namespace std;class V{public:void set_value();void get_V();void show_V();private:float length;float width;float height;float v;};void V::set_value(){cin>>length;cin>>width;cin>>height;}void V::get_V(){v=length*width*height;}void V::show_V(){cout<<"V="<<v<<endl;}int main(){V V1;V1.set_value();V1.get_V();V1.show_V();return 0;}


原创粉丝点击