Welcome Guest ( Log In | Register)



2 Pages V   1 2 >  
Reply to this topicStart new topic
> Crazy Looking C Program, Interesting
cse-icons
post May 15 2005, 12:04 PM
Post #1


Super Member
*********

Group: Members
Posts: 351
Joined: 19-October 04
From: India
Member No.: 1,824



hi friends,

Have a look at the following code... Can u guess what this wud do...
nope... no virus nor executable code... It is a completely valid and compilable C program...
dont worry.. I have executed it on my system and it perfectly nice program smile.gif
CODE
#include <stdio.h>

main(t,_,a)
char *a;
{return!0<t?t<3?main(-79,-13,a+main(-87,1-_,
main(-86, 0, a+1 )+a)):1,t<_?main(t+1, _, a ):3,main ( -94, -27+t, a
)&&t == 2 ?_<13 ?main ( 2, _+1, "%s %d %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;# ){n\
l]!/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?_==*a ?putchar(a[31]):main(-65,_,a+1):main((*a == '/')+t,_,a\
+1 ):0<t?main ( 2, 2 , "%s"):*a=='/'||main(0,main(-61,*a, "!ek;dc \
i@bK'(q)-[w]*%n+r3#l,{}:\nuwloca-O;m .vpbks,fxntdCeghiry"),a+1);}


ok... so u give up....
put it in ur compiler and execute it...

surprised......
yup there is a contest held every year, as to who can come up with craziest looking programs and the design and beauty of the program is taken into consideration to decide the winner....

I had a collection of such programs somewhere on my system.. will post them when I find them...

Cheers.
Go to the top of the page
 
+Quote Post
electriic ink
post May 15 2005, 12:09 PM
Post #2


Incest is a game the whole family can play.
Group Icon

Group: [MODERATOR]
Posts: 1,204
Joined: 11-February 05
From: Heaven
Member No.: 3,709



Don't have VBStudio or something that creates programs. What's it do?
Go to the top of the page
 
+Quote Post
twentyinches631
post May 15 2005, 10:36 PM
Post #3


Member [Level 2]
*****

Group: Members
Posts: 81
Joined: 15-May 05
Member No.: 7,069



I couldn't get it to compile in visual studio, but maybe I'm just retarded.
Go to the top of the page
 
+Quote Post
switch
post May 16 2005, 10:13 AM
Post #4


Premium Member
********

Group: Members
Posts: 178
Joined: 13-October 04
From: NSW, Australia
Member No.: 1,713



hmmm.... creative!!!!

sorry, i'm not game enuf to compile and run it tongue.gif, but yep there's points for randomness and creativity!!!

next year it needs to be written in such away that it looks like something by Leonardo Da Vinci laugh.gif
Go to the top of the page
 
+Quote Post
cse-icons
post May 16 2005, 10:25 AM
Post #5


Super Member
*********

Group: Members
Posts: 351
Joined: 19-October 04
From: India
Member No.: 1,824



Hi friends,

I dont know how you wud compile it in Visual studio. I do it in Turbo C compiler or turbo c++.

It compiles without even a warning....

Here is the output....

--------------------------------------------------------------------
On the first day of Christmas my true love gave to me
a partridge in a pear tree.

On the second day of Christmas my true love gave to me
two turtle doves
and a partridge in a pear tree.

On the third day of Christmas my true love gave to me
three french hens, two turtle doves
and a partridge in a pear tree.

On the fourth day of Christmas my true love gave to me
four calling birds, three french hens, two turtle doves
and a partridge in a pear tree.

On the fifth day of Christmas my true love gave to me
five gold rings;
four calling birds, three french hens, two turtle doves
and a partridge in a pear tree.

On the sixth day of Christmas my true love gave to me
six geese a-laying, five gold rings;
four calling birds, three french hens, two turtle doves
and a partridge in a pear tree.

On the seventh day of Christmas my true love gave to me
seven swans a-swimming,
six geese a-laying, five gold rings;
four calling birds, three french hens, two turtle doves
and a partridge in a pear tree.

On the eighth day of Christmas my true love gave to me
eight maids a-milking, seven swans a-swimming,
six geese a-laying, five gold rings;
four calling birds, three french hens, two turtle doves
and a partridge in a pear tree.

On the ninth day of Christmas my true love gave to me
nine ladies dancing, eight maids a-milking, seven swans a-swimming,
six geese a-laying, five gold rings;
four calling birds, three french hens, two turtle doves
and a partridge in a pear tree.

On the tenth day of Christmas my true love gave to me
ten lords a-leaping,
nine ladies dancing, eight maids a-milking, seven swans a-swimming,
six geese a-laying, five gold rings;
four calling birds, three french hens, two turtle doves
and a partridge in a pear tree.

On the eleventh day of Christmas my true love gave to me
eleven pipers piping, ten lords a-leaping,
nine ladies dancing, eight maids a-milking, seven swans a-swimming,
six geese a-laying, five gold rings;
four calling birds, three french hens, two turtle doves
and a partridge in a pear tree.

On the twelfth day of Christmas my true love gave to me
twelve drummers drumming, eleven pipers piping, ten lords a-leaping,
nine ladies dancing, eight maids a-milking, seven swans a-swimming,
six geese a-laying, five gold rings;
four calling birds, three french hens, two turtle doves
and a partridge in a pear tree.
--------------------------------------------------------------------



unbelievable..............but true...
in case u dont believe it, just try it out... even gcc or linux based c compilers should work...

Cheers.

Go to the top of the page
 
+Quote Post
nagu
post May 16 2005, 01:18 PM
Post #6


Newbie [Level 2]
**

Group: Members
Posts: 32
Joined: 6-May 05
Member No.: 6,709



The following is one of the winners of 2004 International Obfuscated Code contest

CODE

#include <ncurses.h>/*****************************************************/
           int               m[256                   ] [         256   ],a
,b  ;;;  ;;;   WINDOW*w;   char*l=""   "\176qxl"   "q"   "q"   "k"   "w\
xm"   "x"   "t"         "j"         "v"         "u"         "n"         ,Q[
]=   "Z"   "pt!ftd`"   "qdc!`eu"   "dq!$c!nnwf"/**   ***   */"t\040\t";c(
int   u ,         int         v){                     v?m   [u]         [v-
1]   |=2,m[u][v-1] &   48?W][v-1   ] &   15]]):0:0;u?m[u   -1][v]|=1   ,m[
u-               1][   v]&         48?               W-1   ][v         ]&
15]   ]):0:0;v<   255   ?m[   u][v+1]|=8,m[u][v+1]&   48?   W][   v+1]&15]]
):0         :0;         u <               255   ?m[   u+1         ][v   ]|=
4,m[u+1][   v]&48?W+1][v]&15]]):0:0;W][   v]&   15]   ]);}cu(char*q){   return
*q               ?cu   (q+         1)&         1?q   [0]               ++:
q[0   ]--   :1;   }d(   int   u ,   int/**/v,   int/**/x,   int   y){   int
Y=y   -v,   X=x         -u;   int         S,s  ;Y<         0?Y   =-Y   ,s,
s=-   1:(   s=1);X<0?X=-X,S   =-1  :(S=   1);   Y<<=   1;X<<=1;   if(X>Y){
int   f=Y               -(X   >>1   );;               while(u!=         x){
f>=   0?v+=s,f-=X:0;u   +=S  ;f+=   Y;m[u][v]|=32;mvwaddch(w,v   ,u,   m[u
][               v]&   64?   60:         46)        ;if         (m[   u][
v]&16){c(u,v);;  ;;;  ;;;   return;}}   }else{int   f=X   -(Y>>1);;   while
(v   !=y         ){f   >=0         ?u   +=S,               f-=         Y:0
;v   +=s  ;f+=X;m[u][v]|=   32;mvwaddch(w,v   ,u,m[u][v]&64?60:46);if(m[u
][                     v]&         16)   {c(   u,v                     );
;   return;;;}}}}Z(   int/**/a,   int   B){   }e(   int/**/y,int/**/  x){
int               i;         for         (i=         a;i               <=a
+S;i++)d(y,x,i,B),d(y,x,i,b+L);for(i=b;i<=b+L;i++)d(y,x,a,i),d(y,x,a+   S,i
);                    ;;;        ;;;        ;;;              ;;;  ;
 mvwaddch(w,x,y,64);  ;;;  ;;;  ;;;   prefresh(   w,b,a,0,0   ,L-   1,S-1
);}             main(         int               V ,   char              *C[
 ]   ){FILE*f=   fopen(V==1?"arachnid.c"/**/   :C[   1],"r");int/**/x,y,c,
v=0        ;;;      initscr              ();               Z(Z         (raw
()   ,Z(   curs_set(0),Z(1   ,noecho()))),keypad(    stdscr,TRUE));w   =newpad
 (   300,  300               );   for         (x=   255  ; x   >=0  ;x--
 )   for   (y=   255  ;y>=0;y--   )m[   x][   y]=   0;x=y=0;refresh( );while
 (   (c=                           fgetc (f)   )+1)                    {if(
0||c==10||  x==   256){x=0;y++;if(y==256  )break;;}   else{m[x][y]=(c   ==
'~'   ?64   : c   ==32              ?0:         16)  ;;x               ++;
     }}for(x=0  ;x<   256;x++)m   [x][0]=16   ,m[   x][   255]=16;for(y=0
;y<         256  ; y         ++)   m[0         ][y   ] =               16,
m[255][y]   =16  ;a=b=c=0;   x=y   =1;   do{v++;mvwaddch   (w,   y,x   ,m[
x][         y]&               32?   m[x                     ][y   ] &   16?
0|   acs_map[l[m[x][y]&15]]:46 :   32);c==0163&&!(m[x][y+1]&16)?y++:   0;c
==   119         &&!         (m[                                       x][
y-   1]&   16)   ?y--:0;;c   ==97  &&!(m[x-1][y]&16)?x--:0;c==100&&!(m[x+1
][   y]&   16)         ? x   ++:0             ;if(                    c==
3-   1+1   ){endwin(   );;   return(0)  ;}x   -a<5?a>S-   5?a-=S-5:(a=0):
0;x               -a>         S-5?a<255   -S*         2?a               +=S
-5:(a=256-S):0;   y-b<5?b>L-5?b-=L-5:(b   =0)   :0;   y-b>L-5?b<255-L   *2?
b+=                                       L-5   :(b                     =256
-L)   :0;e(x,y);if(m[x][y]&64)break;}while((c=getch())!=-1);endwin();cu(Q);
printf(Q,v);}


Notice from BuffaloHELP:
Entered CODE tags.


This post has been edited by BuffaloHELP: May 17 2005, 04:10 AM
Go to the top of the page
 
+Quote Post
nagu
post May 16 2005, 01:26 PM
Post #7


Newbie [Level 2]
**

Group: Members
Posts: 32
Joined: 6-May 05
Member No.: 6,709



And this one also ...more details you can get here link

CODE

          /*                                     ,*/
           #include                              <time.h>
            #include/*                     _  ,o*/  <stdlib.h>
            #define  cİ/*     -      . */return      ( C); /*    2004*/
             #include   <stdio.h>/*.   Moekan           "'   `\b-'     */
               typedef/*  */char   p;p* u                     ,w       [9
                 ][128] ,*v;typedef  int _;_   R,i,N,I,A               ,m,o,e
            [9],  a[256],k    [9], n[               256];FILE*f      ;_ x   (_ K,_ r
       ,_ q){;   for(;                                         r<     q   ; K       =((
    0xffffff)   &(K>>8))^                                        n[255     &        ( K
  ^u[0        +                                     r  ++      ]     )]);c          (K
 )}        _ E                           (p*r,    p*q  ){     c(          f         =
         fopen                     (r  ,q))}_   B(_ q){c(    fseek        (f,      0
       ,q))}_ D(){c(  fclose(f ))}_  C(  p    *q){c(  0-    puts(q    )   )}_/*   /
     */main(_ t,p**z){if(t<4)c(   C("<in"       "file>"    "\40<l"   "a"  "yout> "
    /*b9213272*/"<outfile>"   ) )u=0;i=I=(E(z[1],"rb")) ?B(2)?0 :   (((o   =ftell
   (f))>=8)?(u     =(p*)malloc(o))?B(0)?0:!fread(u,o,1,f):0:0)?0:  D():0     ;if(
  !u)c(C("      bad\40input  "));if(E(z[2],"rb" )){for(N=-1;256> i;n[i++] =-1   )a[
  i]=0;       for(i=I=0;   i<o&&(R  =fgetc(   f))>-1;i++)++a[R] ?(R==N)?( ++I>7)?(n[
 N]+1       )?0:(n [N   ]=i-7):0:   (N=R)    |(I=1):0;A =-1;N=o+1;for(i=33;i<127;i++
 )(        n[i   ]+  1&&N>a[i])?    N= a     [A=i]     :0;B(i=I=0);if(A+1)for(N=n[A];
I<       8&&   (R  =fgetc(f ))>    -1&& i   <o       ;i++)(i<N||i>N+7)?(R==A)?((*w[I
]             =u [i])?1:(*w[I]=   46))?(a             [I++]=i):0:0:0;D();}if(I<1)c(C(
             "  bad\40la" "yout  "))for(i            =0;256>(R=  i);n[i++]=R)for(A=8;
            A  >0;A --)   R  = ( (R&1)==0)          ?(unsigned int)R>>(01):((unsigned
           /*kero  Q'        ,KSS  */)R>>         1)^        0xedb88320;m=a[I-1];a[I
           ]=(m           <N)?(m=   N+8):        ++        m;for(i=00;i<I;e[i++]=0){
          v=w         [i]+1;for(R                      =33;127  >R;R++)if(R-47&&R-92
          &&       R-(_)* w[i])*(                   v++)=    (p)R;*v=0;}for(sprintf
                 /*'_  G*/  (*w+1,              "%0"     "8x",x(R=time(i=0),m,o)^~
               0)  ;i<       8;++           i)u      [N+ i]=*(*w+i+1);for(*k=x(~
                 0,i=0     ,*a);i>-        1;      ){for (A=i;A<I;A++){u[+a [ A]
               ]=w[A       ][e[A]] ;     k     [A+1]=x (k[A],a[A],a[A+1]
             );}if     (R==k[I])      c(      (E(z[3  ],"wb+"))?fwrite(
            /* */   u,o,1,f)?D          ()|C("  \n    OK."):0    :C(
           "  \n  WriteError"            ))  for  (i  =+I-
          1 ;i >-1?!w[i][++                 e[+ i]]:0;
            ) for( A=+i--;                 A<I;e[A++]
            =0); (i <I-4                 )?putchar
            ((_   )  46)                  | fflush
           /*'      ,*/                  ( stdout
           ):       0&                    0;}c(C
          ("       \n                   fail")
          )      /*                    dP' /
                dP                    pd  '
               '                      zc
                                     */
                                    }