您的位置:首页 > 编程语言 > C语言/C++

c++

2016-05-31 22:57 537 查看
/*

*Copyright (c) 2016,烟台大学计算机学院

*All rights reserved.

*文件名称:text.cpp

*作者:陈传祯

*完成日期:2016年5月31日

*版本号:v1.0

问题描述:

*/

#include <iostream>

using namespace std;

class P

{

    int a;

    int b;

public:

    P(int i,int j):a(i),b(j){}

    bool operator>(P p)const;

};

bool P::operator>(P p)const

{

    if(m!=p.a)

        return a>p.a;

       return b>p.b;

}

int main(){

    P p1(3,4),p2(4,3),p3(4,5);

    cout<<(p1>p2)<<(p2>p1)<<(p2>p3)<<(p3>p2);

    return 0;

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