Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

basic cpp

#include <bits/stdc++.h>

using namespace std;

const int DIFF = 10;

template <typename T>
struct Point {
    T x, y;
    
    Point(T _x, T _y) : x(_x), y(_y) {}
    
    friend ostream& operator<<(ostream& os, const Point& p) {
        return os << "(" << p.x << ", " << p.y << ")";
    }
};

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    vector<Point<int>> v;
    for (int i = 0; i < 5; ++i) {
        v.push_back({i, i + DIFF});
    }
    for (auto p : v) {
        if (p.x + DIFF == p.y) {
            cout << p << '
';
        } else {
            cout << "huh!?
"; // will never get printed!
        }
    }
}
Source by codeforces.com #
 
PREVIOUS NEXT
Tagged: #basic #cpp
ADD COMMENT
Topic
Name
3+2 =