您的位置:首页 > 其它

第5周项目--程序阅读

2015-04-05 15:51 197 查看
#include<iostream>
using namespace std;
class CE
{
private:
    int a,b;
    int getmin(){return (a<b? a:b);}
public:
    int c;
    void SetValue(int x1,int x2, int x3)
    {
        a=x1;
        b=x2;
        c=x3;
    }
    int GetMin();
};

int CE::GetMin()
{
    int d=getmin();
    return (d<c? d:c);
}

int main()
{
    int x=5,y=12,z=8;
    CE *ep;
    ep=new CE;
    ep->SetValue(x+y,y-z,10);
    cout<<ep->GetMin()<<endl;
    CE a=*ep;
    cout<<a.GetMin()*3+15<<endl;
    return 0;
}


内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: