精品偷拍一区二区三区,亚洲精品永久 码,亚洲综合日韩精品欧美国产,亚洲国产日韩a在线亚洲

  • <center id="usuqs"></center>
  • 
    
  • c++需要求3個長方柱體積

    c++需要求3個長方柱體積
    其他人氣:431 ℃時間:2020-05-26 11:43:12
    優(yōu)質(zhì)解答
    #include <iostream>
    using namespace std;
    class cube
    {
    public:
        void set();//構(gòu)造函數(shù)
        float com_volume();//計算體積
        void disp();//輸出體積
    private:
        float length;
        float width;
        float height;
    };
    void cube::set()
    {
        float l, w, h;
        cout<<"下面進(jìn)入長方柱的參數(shù)設(shè)置,單位:立方米"<<endl;
        cout<<"請輸入長方柱的長:";
        cin>>l;
        length=l;
        cout<<"請輸入長方柱的寬:";
        cin>>w;
        width=w;
        cout<<"請輸入長方柱的高:";
        cin>>h;
        height=h;
    }
    float cube::com_volume()
    {
        return length*width*height;
    }
    void cube::disp()
    {
        cout<<"此長方柱的體積為:"<<com_volume()<<"立方米"<<endl;
    }
    int main()
    {
        cube c[3];
        for(int i=0; i<3; i++)
        {
            c[i].set() ;
            c[i].disp();
            cout<<endl;
        }
        return 0;
    }
    我來回答
    類似推薦
    請使用1024x768 IE6.0或更高版本瀏覽器瀏覽本站點,以保證最佳閱讀效果。本頁提供作業(yè)小助手,一起搜作業(yè)以及作業(yè)好幫手最新版!
    版權(quán)所有 CopyRight © 2012-2024 作業(yè)小助手 All Rights Reserved. 手機(jī)版