Skip to main content
replaced http://codegolf.stackexchange.com/ with https://codegolf.stackexchange.com/
Source Link

C++, 286 284 236 bytes

Now with extra golf!

#include<iostream>
int main(){char a[]="#include<iostream>%sint main(){char a[]=%s%s%s,b[]=%s%s%s%s,c[]=%s%sn%s,d[]=%s%s%s%s;printf(a,c,b,a,b,b,d,b,b,b,d,b,b,d,d,b);}",b[]="\"",c[]="\n",d[]="\\";printf(a,c,b,a,b,b,d,b,b,b,d,b,b,d,d,b);}

I'm currently learning C++, and thought "Hey, I should make a quine in it to see how much I know!" 40 minutes later, I have this, a full 64 114 bytes shorter than the current onethe current one. I compiled it as:

g++ quine.cpp

Output and running:

C:\Users\Conor O'Brien\Documents\Programming\cpp
λ g++ quine.cpp & a
#include<iostream>
int main(){char a[]="#include<iostream>%sint main(){char a[]=%s%s%s,b[]=%s%s%s%s,c[]=%s%sn%s,d[]=%s%s%s%s;printf(a,c,b,a,b,b,d,b,b,b,d,b,b,d,d,b);}",b[]="\"",c[]="\n",d[]="\\";printf(a,c,b,a,b,b,d,b,b,b,d,b,b,d,d,b);}

C++, 286 284 236 bytes

Now with extra golf!

#include<iostream>
int main(){char a[]="#include<iostream>%sint main(){char a[]=%s%s%s,b[]=%s%s%s%s,c[]=%s%sn%s,d[]=%s%s%s%s;printf(a,c,b,a,b,b,d,b,b,b,d,b,b,d,d,b);}",b[]="\"",c[]="\n",d[]="\\";printf(a,c,b,a,b,b,d,b,b,b,d,b,b,d,d,b);}

I'm currently learning C++, and thought "Hey, I should make a quine in it to see how much I know!" 40 minutes later, I have this, a full 64 114 bytes shorter than the current one. I compiled it as:

g++ quine.cpp

Output and running:

C:\Users\Conor O'Brien\Documents\Programming\cpp
λ g++ quine.cpp & a
#include<iostream>
int main(){char a[]="#include<iostream>%sint main(){char a[]=%s%s%s,b[]=%s%s%s%s,c[]=%s%sn%s,d[]=%s%s%s%s;printf(a,c,b,a,b,b,d,b,b,b,d,b,b,d,d,b);}",b[]="\"",c[]="\n",d[]="\\";printf(a,c,b,a,b,b,d,b,b,b,d,b,b,d,d,b);}

C++, 286 284 236 bytes

Now with extra golf!

#include<iostream>
int main(){char a[]="#include<iostream>%sint main(){char a[]=%s%s%s,b[]=%s%s%s%s,c[]=%s%sn%s,d[]=%s%s%s%s;printf(a,c,b,a,b,b,d,b,b,b,d,b,b,d,d,b);}",b[]="\"",c[]="\n",d[]="\\";printf(a,c,b,a,b,b,d,b,b,b,d,b,b,d,d,b);}

I'm currently learning C++, and thought "Hey, I should make a quine in it to see how much I know!" 40 minutes later, I have this, a full 64 114 bytes shorter than the current one. I compiled it as:

g++ quine.cpp

Output and running:

C:\Users\Conor O'Brien\Documents\Programming\cpp
λ g++ quine.cpp & a
#include<iostream>
int main(){char a[]="#include<iostream>%sint main(){char a[]=%s%s%s,b[]=%s%s%s%s,c[]=%s%sn%s,d[]=%s%s%s%s;printf(a,c,b,a,b,b,d,b,b,b,d,b,b,d,d,b);}",b[]="\"",c[]="\n",d[]="\\";printf(a,c,b,a,b,b,d,b,b,b,d,b,b,d,d,b);}
added 44 characters in body
Source Link
Conor O'Brien
  • 40.2k
  • 3
  • 91
  • 180

C++, 286 284284 236 bytes

Now with extra golf!

#include<iostream>
int main(){char a[]="#include<iostream>%sint main(){char a[]=%s%s%s;char b[]=%s%s%s%s;char c[]=%s%sn%s;char a[]=%s%s%s,b[]=%s%s%s%s,c[]=%s%sn%s,d[]=%s%s%s%s;printf(a,c,b,a,b,b,d,b,b,b,d,b,b,d,d,b);return 0;;}";char b[]="\"";char c[]="\n";char ",b[]="\"",c[]="\n",d[]="\\";printf(a,c,b,a,b,b,d,b,b,b,d,b,b,d,d,b);return 0;;}

I'm currently learning C++, and thought "Hey, I should make a quine in it to see how much I know!" 40 minutes later, I have this, a full 6464 114 bytes shorter than the current onethe current one. I compiled it as:

g++ quine.cpp

Output and running:

C:\Users\Conor O'Brien\Documents\Programming\cpp
λ g++ quine.cpp &&& a
#include<iostream>
int main(){char a[]="#include <iostream>%sinta[]="#include<iostream>%sint main(){char a[]=%s%s%s;char b[]=%s%s%s%s;char c[]=%s%sn%s;char a[]=%s%s%s,b[]=%s%s%s%s,c[]=%s%sn%s,d[]=%s%s%s%s;printf(a,c,b,a,b,b,d,b,b,b,d,b,b,d,d,b);return 0;;}";char b[]="\"";char c[]="\n";char ",b[]="\"",c[]="\n",d[]="\\";printf(a,c,b,a,b,b,d,b,b,b,d,b,b,d,d,b);return 0;;}

C++, 286 284 bytes

#include<iostream>
int main(){char a[]="#include<iostream>%sint main(){char a[]=%s%s%s;char b[]=%s%s%s%s;char c[]=%s%sn%s;char d[]=%s%s%s%s;printf(a,c,b,a,b,b,d,b,b,b,d,b,b,d,d,b);return 0;}";char b[]="\"";char c[]="\n";char d[]="\\";printf(a,c,b,a,b,b,d,b,b,b,d,b,b,d,d,b);return 0;}

I'm currently learning C++, and thought "Hey, I should make a quine in it to see how much I know!" 40 minutes later, I have this, a full 64 bytes shorter than the current one. I compiled it as:

g++ quine.cpp

Output and running:

C:\Users\Conor O'Brien\Documents\Programming\cpp
λ g++ quine.cpp && a
#include<iostream>
int main(){char a[]="#include <iostream>%sint main(){char a[]=%s%s%s;char b[]=%s%s%s%s;char c[]=%s%sn%s;char d[]=%s%s%s%s;printf(a,c,b,a,b,b,d,b,b,b,d,b,b,d,d,b);return 0;}";char b[]="\"";char c[]="\n";char d[]="\\";printf(a,c,b,a,b,b,d,b,b,b,d,b,b,d,d,b);return 0;}

C++, 286 284 236 bytes

Now with extra golf!

#include<iostream>
int main(){char a[]="#include<iostream>%sint main(){char a[]=%s%s%s,b[]=%s%s%s%s,c[]=%s%sn%s,d[]=%s%s%s%s;printf(a,c,b,a,b,b,d,b,b,b,d,b,b,d,d,b);}",b[]="\"",c[]="\n",d[]="\\";printf(a,c,b,a,b,b,d,b,b,b,d,b,b,d,d,b);}

I'm currently learning C++, and thought "Hey, I should make a quine in it to see how much I know!" 40 minutes later, I have this, a full 64 114 bytes shorter than the current one. I compiled it as:

g++ quine.cpp

Output and running:

C:\Users\Conor O'Brien\Documents\Programming\cpp
λ g++ quine.cpp & a
#include<iostream>
int main(){char a[]="#include<iostream>%sint main(){char a[]=%s%s%s,b[]=%s%s%s%s,c[]=%s%sn%s,d[]=%s%s%s%s;printf(a,c,b,a,b,b,d,b,b,b,d,b,b,d,d,b);}",b[]="\"",c[]="\n",d[]="\\";printf(a,c,b,a,b,b,d,b,b,b,d,b,b,d,d,b);}
added 9 characters in body
Source Link
Conor O'Brien
  • 40.2k
  • 3
  • 91
  • 180

C++, 286286 284 bytes

#include <iostream>#include<iostream>
int main(){char a[]="#include <iostream>%sinta[]="#include<iostream>%sint main(){char a[]=%s%s%s;char b[]=%s%s%s%s;char c[]=%s%sn%s;char d[]=%s%s%s%s;printf(a,c,b,a,b,b,d,b,b,b,d,b,b,d,d,b);return 0;}";char b[]="\"";char c[]="\n";char d[]="\\";printf(a,c,b,a,b,b,d,b,b,b,d,b,b,d,d,b);return 0;}

I'm currently learning C++, and thought "Hey, I should make a quine in it to see how much I know!" 40 minutes later, I have this, a full 64 bytes shorter than the current one. I compiled it as:

g++ quine.cpp

Output and running:

C:\Users\Conor O'Brien\Documents\Programming\cpp
λ g++ quine.cpp && a
#include <iostream>#include<iostream>
int main(){char a[]="#include <iostream>%sint main(){char a[]=%s%s%s;char b[]=%s%s%s%s;char c[]=%s%sn%s;char d[]=%s%s%s%s;printf(a,c,b,a,b,b,d,b,b,b,d,b,b,d,d,b);return 0;}";char b[]="\"";char c[]="\n";char d[]="\\";printf(a,c,b,a,b,b,d,b,b,b,d,b,b,d,d,b);return 0;}

C++, 286 bytes

#include <iostream>
int main(){char a[]="#include <iostream>%sint main(){char a[]=%s%s%s;char b[]=%s%s%s%s;char c[]=%s%sn%s;char d[]=%s%s%s%s;printf(a,c,b,a,b,b,d,b,b,b,d,b,b,d,d,b);return 0;}";char b[]="\"";char c[]="\n";char d[]="\\";printf(a,c,b,a,b,b,d,b,b,b,d,b,b,d,d,b);return 0;}

I'm currently learning C++, and thought "Hey, I should make a quine in it to see how much I know!" 40 minutes later, I have this, a full 64 bytes shorter than the current one. I compiled it as:

g++ quine.cpp

Output and running:

C:\Users\Conor O'Brien\Documents\Programming\cpp
λ g++ quine.cpp && a
#include <iostream>
int main(){char a[]="#include <iostream>%sint main(){char a[]=%s%s%s;char b[]=%s%s%s%s;char c[]=%s%sn%s;char d[]=%s%s%s%s;printf(a,c,b,a,b,b,d,b,b,b,d,b,b,d,d,b);return 0;}";char b[]="\"";char c[]="\n";char d[]="\\";printf(a,c,b,a,b,b,d,b,b,b,d,b,b,d,d,b);return 0;}

C++, 286 284 bytes

#include<iostream>
int main(){char a[]="#include<iostream>%sint main(){char a[]=%s%s%s;char b[]=%s%s%s%s;char c[]=%s%sn%s;char d[]=%s%s%s%s;printf(a,c,b,a,b,b,d,b,b,b,d,b,b,d,d,b);return 0;}";char b[]="\"";char c[]="\n";char d[]="\\";printf(a,c,b,a,b,b,d,b,b,b,d,b,b,d,d,b);return 0;}

I'm currently learning C++, and thought "Hey, I should make a quine in it to see how much I know!" 40 minutes later, I have this, a full 64 bytes shorter than the current one. I compiled it as:

g++ quine.cpp

Output and running:

C:\Users\Conor O'Brien\Documents\Programming\cpp
λ g++ quine.cpp && a
#include<iostream>
int main(){char a[]="#include <iostream>%sint main(){char a[]=%s%s%s;char b[]=%s%s%s%s;char c[]=%s%sn%s;char d[]=%s%s%s%s;printf(a,c,b,a,b,b,d,b,b,b,d,b,b,d,d,b);return 0;}";char b[]="\"";char c[]="\n";char d[]="\\";printf(a,c,b,a,b,b,d,b,b,b,d,b,b,d,d,b);return 0;}
Source Link
Conor O'Brien
  • 40.2k
  • 3
  • 91
  • 180
Loading