#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!
}
}
}
Code Example |
---|
Cpp :: hierarchical inheritance in c++ employee |
Cpp :: printing in column c++ |
Cpp :: c++ unittest in ros |
Cpp :: initialize 2d vector c++ |
Cpp :: cmd color text c++ |
Cpp :: function c++ example |
Cpp :: accumulate in cpp |
Cpp :: sliding window c++ |
Cpp :: c++ pass ofstream as argument |
Cpp :: call function from separate bash script |
Cpp :: C++ if...else...else if statement |
Cpp :: for auto c++ |
Cpp :: max heap insertion c++ |
Cpp :: len in cpp |
Cpp :: c++ lambda as variable |
Cpp :: pointers c++ |
Cpp :: find factorial in c++ using class |
Cpp :: if in c++ |
Cpp :: insertion overloading in c++ |
Cpp :: << in C++ |
Cpp :: convert uppercase to lowercase |
Cpp :: sstream c++ |
Cpp :: cpp algorithm iota |
Cpp :: error C2011 |
Cpp :: creating large maps cpp |
Cpp :: warning: base will be initialized after |
Cpp :: nmake.exe is not found in the windows |
Cpp :: get range sum |
Cpp :: coin change top-down |
Cpp :: is variable sized array are not allowed in c++? |