Last active
August 29, 2015 14:19
-
-
Save megaserg/2c4f0ddb80b53918e54d to your computer and use it in GitHub Desktop.
Ugly C++ quine
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
#!/bin/bash | |
g++ -O2 -Wall quine.cpp -o quine && ./quine > result.cpp && diff quine.cpp result.cpp |
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 <string> | |
using namespace std;char n[]={92,110};int main(){string s="#include <iostream>\n#include <string>\nusing namespace std;char n[]={92,110};int main(){string s=\"\",t=s;cout<<s.replace(97,0,t.replace(19,1,n).replace(38,1,n).replace(98,0,1,92).replace(100,0,1,92));}",t=s;cout<<s.replace(97,0,t.replace(19,1,n).replace(38,1,n).replace(98,0,1,92).replace(100,0,1,92));} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment