Archives
Trending
Support
Login
clear text
XML
Django
JavaScript
MATLAB
C
C++
C#
Python
SQL
Shell
Bash
Markdown
YAML
JSON
HTML
CSS
PHP
Java
Ruby
Go
Rust
Swift
Kotlin
Arduino
TypeScript
Perl
Autohotkey
Lua
SQF
R
Scala
Haskell
Groovy
Dart
Clojure
VB.NET
Objective-C
PowerShell
Bash
CoffeeScript
Verilog
#include
using namespace std; class Point { int x; int y; public: Point() {} Point(int _x, int _y) { x = _x; y = _y; } void set_x(int _x) { x = _x; } void set_y(int _y) { y = _y; } int get_x() { return x; } int get_y() { return y; } Point operator + (Point tmp) { Point result(x + tmp.x, y + tmp.y); return result; } Point operator - (Point tmp) { Point result(x - tmp.x, y - tmp.y); return result; } Point operator * (Point tmp) { Point result(x * tmp.x, y * tmp.y); return result; } Point operator / (Point tmp) { Point result(x / tmp.x, y / tmp.y); return result; } bool operator < (Point tmp) { if(x < tmp.x and y < tmp.y) { return true; } else { return false; } } bool operator <= (Point tmp) { if(x <= tmp.x and y <= tmp.y) { return true; } else { return false; } } bool operator > (Point tmp) { if(x > tmp.x and y > tmp.y) { return true; } else { return false; } } bool operator >= (Point tmp) { if(x >= tmp.x and y >= tmp.y) { return true; } else { return false; } } bool operator == (Point tmp) { if(x == tmp.x and y == tmp.y) { return true; } else { return false; } } bool operator != (Point tmp) { if(x != tmp.x or y != tmp.y) { return true; } else { return false; } } friend ostream & operator << (ostream & stream, Point tmp); }; ostream & operator << (ostream & stream, Point tmp) { stream << tmp.x << " "; stream << tmp.y; return stream; } int main() { Point p1(4, 4); Point p2(5, 3); cout << p1 << endl; cout << p2 << endl; return 0; }
Mark as private (unlisted)
for 30 minutes
for 6 hours
for 1 day
for 1 week
for 1 month
for 1 year
everlasting (like CCCP)