Program code
# Include <stdio. h>
Main (t, _,)
Char *;
{
Return! 0 <t? T <3? Main (-79,-13, a + main (-87,1-_, main (-86,0, a + 1) + )):
1, t <_? Main (t + 1, _, a): 3, main (-94,-27 + t, a) & t = 2? _ <13?
Main (2, _ + 1, "% s % d \ n"): 9: 16: t <0? T <-72? Main (_, t,
"@ N' +, # '/* {} w +/w # cdnr/+, {} r/* de} +,/* {* +, /w {% +,/w # q # n +,/# {l +,/n {n +,/+ # n + ,/#\
; # Q # n +,/+ k #; * +,/'r: 'd * '3,} {w + K W' K: '+} e #'; dq # 'l \
Q # '+ d' K #! /+ K #; q # 'r} eKK #} w'r} eKK {nl] '/#; # q # n') {) #} W '){) {nl] '/+ # n'; d} rw' I ;#\
) {Nl]! /N {n # '; r {# w'r nc {nl]'/# {l, + 'K {rw 'ik {; [{nl] '/w # q # n' wk nw '\
Iwk {KK {nl]! /W {% 'l # w # 'I;: {nl]'/* {q # 'ld; R'} {nlwb! /* De} 'C \
; {Nl '-{} rw]'/+, }##' *} # nc, ', # nw]'/+ kd '+ e} +; # 'rdq # w! Nr '/')} +} {rl # '{n '')#\
} '+ }##(!! /")
: T <-50? _ = *? Putchar (31 [a]): main (-65, _, a + 1): main (* a = '/') + t, _, a + 1)
: 0 <t? Main (2, 2, "% s"): * a = '/' | main (0, main (-61, *,
"! Ek; dc I @ bK '(q)-[w] * % n + r3 # l, {}:\ nuwloca-O; m. vpbks, fxntdCeghiry "), a + 1 );
}
After the program is compiled and run, it is incredible to print a long segment of text that exceeds the source code length, and these strings have never appeared in the source code. I know that C code can be written very strangely, and it is estimated that a lot of recursion has been used to look at this program; but I have never thought of such a ridiculous source code, and it looks like garbled code. I just found out that this code is an award-winning piece of IOCCC.
IOCCC is the International Obfuscated C Code Contest.
This competition has been held for 17 years. Below are some award-winning works in recent years.
You can see more at http://www.au.ioccc.org/years.html, but many others compile and run in linuxlinuxenvironment. It is interesting to see that all the operations in windows are already below.
Assume that the name of your edited file is abc.exe.
Input in dos after compilation
Program code
Abc "ash nazg durhbatuluhk, ash nazg gimbatul, ash nazg thrakatuluhk, agh burzhumh-ishi krimpatul."> abc. pgm
Then use the image editor to view abc. pgm
Program code
# Include \
<Stdio. h>
# Include <stdlib. h>
# Include <string. h>
# Define w "Hk ~ HdA = Jk | Jk ~ LSyL [{M [wMcxNksNss :"
# Define r "Ht @ H | @ = HdJHtJHdYHtY: HtFHtF = JDBIl "\
"DJTEJDFIlMIlM: HdMHdM = I | KIlMJTOJDOIlWITY: 8Y"
# Define S "IT @ I \\@= HdHHtGH | KILJJDIJDH: H | KID "\
"K = HdQHtPH | TIDRJDRJDQ: JC? JK? = JDRJLRI | UItU: 8 TB"
# Define _ (I, j) L [I = 2 * T [j, O [I = O [j-R [j, T [I = 2 *\
R [J-5 * T [j + 4 * O [j-L [j, R [I = 3 * T [j-R [J-3 * O [j + L [j,
# Define t "IS? I \\@= HdGHtGIDJILIJDIItHJTFJDF: 8J"
# Define y yy (4), yy (5), yy (6), yy (7)
# Define yy (I) R [I] = T [I], T [I] = O [I], O [I] = L [I]
# Define Y _ (0], 4]) _ (1], 5]) _ (2], 6]) _ (3], 7]) _ = 1
# Define v (I) (R [I] * _ + T [I]) * _ + O [I]) * _ + L [I]) * 2
Double B = 32, l, k, o, B, _; int Q, s, V, R [8], T [8], O [8], L [8];
# Define q (Q, R) R = * X ++ % 64*8, R | = * X/8 & 7, Q = * X ++ % 8, Q = Q * 64 + * X ++ % 64-256,
# Define p "G \ QG \ P = GLPGTPGdMGdNGtOGlOG" "dSGdRGDPGLPG \ LG \ LHtGHtH :"
# Define W "Hs? H {? = HdGH | FI \ II \ GJlHJ "" lFL \ DLTCMlAM \ @ Ns} Nk |: 8G"
# Define U "EDGEDH = EtCElDH {~ H | AJk} "" Jk? LSzL [| M [wMcxNksNst :"
# Define u "Hs? H | @ = HdFHtEI "" \ HI \ FJLHJTD: 8 H"
Char * x, * X, (* I) [640], z [3] = "4 _",
* Z = "4, 8O4. 8O4G" r U "4 M" u S "4R" u t "4S8CHdDH | E = HtAIDAIt @ IlAJTCJDCIlKI \ K: 8 K" U
"4 TDdWDdW = D \ UD \ VF \ FFdHGtCGtEIDBIDDIlBIdDJT @ JLC: 8D" t "4UGDNG \ L = GDJGLKHL \
FHLGHtEHtE: "p" 4 ZFDTFLT = G | EGlHITBH | DIlDIdE: HtMH | M = JDBJLDKLAKDALDFKtFKdMK \
\ LJTOJ \ NJTMJTM: 8M4aGtFGlG = G | HG | H: G \ IG \ J = G | IG | I: GdKGlL = G | JG | J: 4b "W
S "4d" W t "4g" r w "4 iGlIGlK = G | JG | J: 4kHl @ Ht @ = HdDHtCHdPH | P: HdDHdD = It \
BIlDJTEJDFIdNI \ N: 8N "w" 4lID @ IL @ = HlIH | FHlPH | NHt ^ H | ^: H | MH | N = J \ D \
J \ GK \ OKTOKDXJtXItZI | YIlWI | V: 8 ^ 4mHLGH \ G = HLVH \ V: 4n "u t
"4 p" W "IT @ I \\@ = HdHHtGIDKILIJLGJLG: JK? JK? = JDGJLGI | MJDL: 8M4 \
RHt @ H | @ = HtDH | BJdLJTH: ITEI \ E = ILPILNNtCNlB: 8N4t "W t" 4u"
P "4zI [? Il @ = HlHH | HIDLILIJDII | HKDAJ | A: JtCJtC = JdLJtJL \
THLdFNk | Nc | \
: 8 K "; main (
Int C, char ** A) {for (x = A [1], I = calloc (strlen (x) + 2,163840 );
C-1; C <3? Q = _ = 0, (z [1] = * x ++ )? (* X ++ = 104? Z [1] ^ = 32: -- x), X =
Strstr (Z, z) & (X + = C ++) :( printf ("P2% d 320 4", V = B/2 + 32 ),
V * = 2, s = Q = 0, C = 4): C <4? Q --> 0? I [(int) (l + = o) + B)] [(int) (k + = B)
] = 1 :_? _-=. 5/256, o = (v (2)-(l = v (0)/(Q = 16), B = (v (3) -(k = v (1)
)/Q: * X> 60? Y, q (L [4], L [5]) q (L [6], L [7]) * X-61 | (+ + X, y, y, y ),
Y: * X> 57? ++ X, y, Y: * X> 54? ++ X, B ++ = * X ++ % 64*4: -- C: printf ("% d"
, I [Q] [s] + I [Q] [s + 1] + I [Q + 1] [s] + I [Q + 1] [s + 1]) & (Q + = 2) <V | (Q =
0, s + = 2) <640
| (C = 1 ));}
After compilation, input abs> ioccc_ray.ppm in dos to generate an image (which may take a long time)
Program code
X = 1024; Y = 768; A = 3;
J = 0; K =-10; L =-7; M = 1296; N = 36; O = 255; P = 9; _ = 1 <15; E; s; C; D; F (B) {E = "1" "111886: 6 :?? AAF"
"FHHMMOO55557799 >>> BBBGGIIKK" [B]-64; C = "C =: C ===: C =: c5" "31/513/5131 /"
"31/531/53" [B]-64; S = B <22? 9: 0; D = 2;} I (x, Y, X) {Y? (X ^ = Y, X * X> x? (X ^ = Y): 0, I (x, Y/2, X
) (E = X);} H (x) {I (x, _, 0);} p; q (c, x, y, z, k, l, m, a, B) {F (c
); X-= E * M; y-= S * M; z-= C * M; B = x * x/M + y * y/M + z
* Z/M-D * D * M; a =-x * k/M-y * l/M-z * m/M; p = (B = a * a/M-
B)> = 0? (I (B * M, _, 0), B = E, a + (a> B? -B: B):-1.0);} Z; W; o
(C, x, y, z, k, l, m, a) {Z =! C? -1: Z; c <44? (Q (c, x, y, z, k,
L, m, 0, 0), (p> 0 & c! = A & (p <W | Z <0 ))? (W =
P, Z = c): 0, o (c + 1, x, y, z, k, l, m, a): 0;} Q; T;
U; u; v; w; n (e, f, g, h, I, j, d, a, B, V) {o (0, e, f, g, h, I, j, a); d> 0
& Z> = 0? (E + = h * W/M, f + = I * W/M, g + = j * W/M, F (Z ), u = e-E * M, v = f-S * M, w = g-C * M, B = (-2 * U-2 * v + w)
/3, H (u * u + v * v + w * w), B/= D, B * = B, B * = 200, b/= (M * M), V = Z, E! = 0? (U =-u * M/E, v =-v * M/E, w =-w * M/
E): 0, E = (h * u + I * v + j * w)/M, h-= u * E/(M/2 ), i-= v * E/(M/2), j-= w * E/(M/2), n (e, f, g, h, I, j, d-1
, Z, 0, 0), Q/= 2, T/= 2, U/= 2, V = V <22? 7: (V <30? 1 :( V <38? 2 :( V <44? 4 :( V = 44? 6: 3 ))))
, Q + = V & 1? B: 0, T + = V & 2? B: 0, U + = V & 4? B: 0) :( d = P? (G + = 2
, J = g> 0? G/8: g/20): 0, j> 0? (U = j * j/M, Q = 255-250 * U/M, T = 255
-150 * U/M, U = 255-100 * U/M) :( U = j * j/M, U <M/5? (Q = 255-210 * U
/M, T = 255-435 * U/M, U = 255-720 * U/M) :( U-= M/5, Q = 213-110 * U
/M, T = 168-113 * U/M, U = 111-85 * U/M), d! = P? (Q/= 2, T/= 2
, U/= 2): 0); Q = Q <0? 0: Q> O? O: Q; T = T <0? 0: T> O? O: T; U = U <0? 0:
U> O? O: U;} R; G; B; t (x, y, a, B) {n (M * J + M * 40 * (A * x +) /X/A-M * 20, M * K, M
* L-M * 30 * (A * y + B)/Y/A + M * 15, 0, M, 0, P,-, 0); R + = Q; G + = T; B + = U; ++ a <? T (x, y,,
B) :( ++ B <? T (x, y, 0, B): 0);} r (x, y) {R = G = B = 0; t (x, y, 0, 0 ); x <X? (Printf ("% c", R/A, G
/A, B/A), r (x + 1, y): 0;} s (y) {r (0, -- y? S (y), y: y);} main () {printf ("P6 \ n % I \ n255"
"\ N", X, Y); s (Y );}
After compilation, input abc 0 0 1 to draw the function image of x ^ 2. Input abc-1 0 0 1 to draw the image of x ^ 3-1. You can also try another one.
Program code
# Include <stdio. h>
# Include <stdlib. h>
# Include <math. h>
# Define _; double
# Define void x, x
# Define case (break, default) break [O]: default [O]:
# Define switch (bool); for (; x <bool;
# Define do (if, else) inIine (else)> int # if?
# Define true (-- void ++)
# Define false (++ void --)
Char * O = "<60> !? \ N "_ doubIe [010] _ int0, int1 _ Iong = 0 _ inIine (int eIse) {int
O1O =! O _ l =! O; for (; O1O <010; ++ O1O) l ++ = (O1O [doubIe] * pow (eIse, O1O); return l ;} int
Main (int booI, char * eIse []) {int I = 1, x =-* O; if (eIse) {for (; I <010 + 1; I ++) I [doubIe-1]
= BooI> I? Atof (I [eIse]):! O switch (* O) x ++) abs (inIine (x)> Iong & (Iong = abs (inIine (x
); Int1 = Iong; main (-* O>);} else {if (booI <* O> 1) {int0 = int1; int1 = int0-2 * Iong/0
[O] switch (5 [O]) putchar (x-* O? (Int0> = inIine (x) & do (1, x) do (0, true) do (0, false)
Case (2, 1) do (1, true) do (0, false) 6 [O] case (-3, 6) do (0, false) 6 [O]-3 [O]: do (1, false)
Case (5, 4) x? BooI? 0: 6 [O]: 7 [O]) + * O: 8 [O]), x ++; main (++ booI, 0 );}}}
High-Precision initiator. This is a bit interesting. It has been sent to OIBH.
Enter abc 01524157875019052100.
The number you entered must have an even number. Otherwise, add the leading 0 to complement the number.
Program code
# Include <stdio. h>
Int l; int main (int o, char ** O,
Int I) {char c, * D = O [1]; if (o> 0 ){
For (l = 0; D [l]; D [l
++]-= 10) {D [l ++]-= 120; D [l]-=
110; while (! Main (0, O, l) D [l]
+ = 20; putchar (D [l] + 1032)
/20);} putchar (10);} else {
C = o + (D [I] + 82) % 10-(I> l/2 )*
(D [I-l + I] + 72)/10-9; D [I] + = I <0? 0
:! (O = main (c/10, O, I-1) * (c + 999
) % 10-(D [I] + 92) % 10);} return o ;}
Draw a moon
Program code
# Include <stdio. h>
# Include <math. h>
Double l; main (_, o, O) {return putchar (_ -- + 22 & _ + 44 & main (_,-43 ,_), _ & o )? (Main (-43, ++ o, O), (l = (o + 21)/sqrt (3-O * 22-O * O ), l * l <4 & (fabs (time (0)-607728) % 2551443)/405859. -4.7 + acos (l/2) <1.57) ["#"]): 10 );}
Word guessing game similar to hangman
Program code
# Ifndef int
# Ifdef while
Char s [234], d [56], * p = s, m = 'M ';
# Define int typedef (* define )();\
Define O [6] = {getc, putchar, (y) memmove, (y) printf, (y) n, (y) l };
# Include _ FILE __
Signed short n (short bz ){
Short pb = 0, Md = 1, ih = 2, sfp = 3, sjs = 4, fo, u = 5, scp = 6, t, gq = 7, oh, r = 8, pcf = 9, rs = 10;
Char o = 1, I = 1, l, pc = I, B = r + o/2, _ f = 6, m = 7, s = 8, g, q, od = o * rs + 4 ^ s, js = _ f/* 3-m * 'C', bs = 'G ';
Return 1 ;}
# Y FILE c [a] + s, p [c], r [m] + u [I + 4 * o | f]-r [wob] [wad] + s * f -! W | o, L + x | cut
;} Int main (I, love_unix) {*/;} int main (I, love_unix) {/*;} int main (I, love_unix ){*\;} | here */
While (FILE) for (; 9-(I = 0 [O] (f )););
For (; 32-(I = 0 [O] (f); 0 & 3 [O] ("--> % s <--", "gxdgbtgxsxpcctvpixktedhiedcte "));
For (; '\ N'-(I = O [0] (f);) (I >= 'A' & I <'Z ')? *
# Include _ FILE __
"Demonic Smiley");}/* <g> */
# Else
# Define while (int) short c = 0; int * f = fopen (__## int #__, "r"); for (I = 0; I <25; I _) I [d] = 'A' + (13 + I) % 26; main:
# Define y define
# Define _ ++
# Include <stdio. h>
# Include <string. h>
# Include <time. h>
# Include _ FILE __
# Endif
# Elif defined (signed)
(P _) = (I-'A') [d]:! (I-'Z ')? * (P _) = 32 :( I> = 'A' & I <= 'Z') & (3 & 8 | 2) [O] (d + 1, d, 24L), * (p _) = 0 [d] = I );/*
# Y FILE t, ra | js + t * gj, at [qdd]-= K, is _, qv _, veb _, ti _, ao [mqht] _ */
If (c _ <6) goto main; 5 [O] (
# Else
# Define signed short l () {char q = '_'; p = s + 4 * (time (NULL) % 24) * 2, m = (char) p + 1 ;\
* (P + 8) = 0; for (d [3] = 10, d [33] = 3 [d]-10; d [3] <18; 3 [d] _) d [3] [p] = q; 3 [d] [p] = 0 ;\
Hell: printf ("\ t [% s] \ n", p + 10); if (! M) goto stoned ;\
Froze: d [8] = (scanf ("% c", & (2 [d + _ STDC _]), 2 [d +! NULL]) & 223; if (! (3 [d + 5]-'\ n') goto froze ;\
For (m = 1 [d] = 0; d [1] <8; 2 [D-1] _) (p [d [1]-d [8] | (p [3 [D-2] + 10] = 4 [d + 4]) + (p [d [1] + 10]-q | m _);\
Goto hell; stoned :;}
FILE * X (FILE s) {char I, iev, jmqhu, xqht, mqh, ujek, sxydw, kdj, yjb, utou, qhre, eamy, jxxe, bt ;}
# Endif