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;
}
*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;
}
相关文章推荐
- Thinking in c++ 第三章
- 一起talk C栗子吧(第一百六十一回:C语言实例--套接字通信模型二)
- C语言中的定义和声明的区别
- leetcode_c++:Insert Intervals(057)
- Ubuntu下配置和编译cpp-ethereum客户端
- C和C++的区别:const
- c++基础:学生成绩
- leetcode_c++:Merge_Intervals(056)
- C语言运行时库中哪些API在UWP中不可用?
- C++ 逆序输出不多于5位的正整数
- 【C++ 学习】03 做个遵纪守法的码农
- error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 解决方法
- leetcode #72 in cpp
- C++经验(一)
- 【C++ 学习】02 符号的十八般武艺
- C++中类对象的内存布局和占用空间
- C++11智能指针读书笔记;
- visual studio2015下载地址
- C++ Primer 类 12.4 explicit 构造函数
- C语言 面试