Skip to content

Instantly share code, notes, and snippets.

@xakepp35
Forked from rafalcieslak/quine.cpp
Created July 15, 2018 02:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xakepp35/c79649551f78c082e1ef68c61481f1bc to your computer and use it in GitHub Desktop.
Save xakepp35/c79649551f78c082e1ef68c61481f1bc to your computer and use it in GitHub Desktop.
C++ Quine
#include <iostream>
int main() {
std::string code1 = R"(
#include <iostream>
int main() {
)";
std::string code2 = R"(
std::cout << code1
<< " std::string code1 = R\"(" << code1 << ")\";\n"
<< " std::string code2 = R\"(" << code2 << ")\";\n"
<< code2;
}
)";
std::cout << code1
<< " std::string code1 = R\"(" << code1 << ")\";\n"
<< " std::string code2 = R\"(" << code2 << ")\";\n"
<< code2;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment