Last active
May 2, 2022 02:13
-
-
Save ConorOBrien-Foxx/29b06e6b0a047fbc46ce521b158870b9 to your computer and use it in GitHub Desktop.
C++ just lets you do this
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <vector> | |
class ElectronBurner { | |
public: | |
std::vector<int> stack { 0 }; | |
size_t size() { return stack.size(); } | |
ElectronBurner& operator++() { | |
if(size() < 1) return *this; | |
++stack.back(); | |
return *this; | |
} | |
ElectronBurner& operator--() { | |
if(size() < 1) return *this; | |
--stack.back(); | |
return *this; | |
} | |
ElectronBurner& operator-() { | |
stack.push_back(0); | |
return *this; | |
} | |
ElectronBurner& operator+() { | |
if(size() < 2) return *this; | |
int b = stack.back(); | |
stack.pop_back(); | |
int a = stack.back(); | |
stack.pop_back(); | |
stack.push_back(a + b); | |
return *this; | |
} | |
ElectronBurner& operator!() { | |
if(size() < 1) return *this; | |
std::cout << (char) stack.back(); | |
return *this; | |
} | |
ElectronBurner& operator*() { | |
if(size() < 2) return *this; | |
int b = stack.back(); | |
stack.pop_back(); | |
int a = stack.back(); | |
stack.pop_back(); | |
stack.push_back(a * b); | |
return *this; | |
} | |
ElectronBurner& operator&() { | |
if(size() < 1) return *this; | |
stack.push_back(stack.back()); | |
return *this; | |
} | |
ElectronBurner& operator~() { | |
if(size() < 2) return *this; | |
std::swap(stack[size() - 1], stack[size() - 2]); | |
return *this; | |
} | |
}; | |
int main() { | |
!+*-+!*++++++-++~!*& & &*++++++&++++-!+**--&--&-- -!++++++!~!+ ++*++++++&++++-+!~!+**++& &++++-&**&*& &++++-!+!!+!+--*++&++++++++++-!*++&++&++++++++&++++++ElectronBurner(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment