首页
社区
课程
招聘
好乱的代码.....
发表于: 2006-1-24 00:28 6318

好乱的代码.....

2006-1-24 00:28
6318
#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;# \){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?_==*a?putchar(31[a]):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);}

用TC编译以后竟然有这样的结果....(Visual C++编译都不通过)
请问有谁知道它的原理?
----------------------
Invalid keyboard code specified
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 eigth 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.

[培训]内核驱动高级班,冲击BAT一流互联网大厂工作,每周日13:00-18:00直播授课

收藏
免费 0
支持
分享
最新回复 (12)
雪    币: 217
活跃值: (99)
能力值: ( LV4,RANK:50 )
在线值:
发帖
回帖
粉丝
2
VC可以编译,只不过有6个warnings.
2006-1-24 01:22
0
雪    币: 217
活跃值: (99)
能力值: ( LV4,RANK:50 )
在线值:
发帖
回帖
粉丝
3
我也发一个,这个程序可以打印自身
char*a??(??)=??<
"??=include<stdio.h>",
"??=include<stdlib.h>",
"??=define o stdout",
"??=define b break;case",
"??=define s(p)fputs(p,o);",
"??=define c(p)fputc(p,o);",
"void t(p,f)char*p;??<f&&c('??/"')",
"for(;;p++)??<switch(*p)??<case 0:f&&",
"s(??/"??/??/??/",??/")c('??/??/n')return;case",
"'??=':s(??/"???/??/?=??/")b'??<':s(??/"???/??/?<??/")",
"b'??>':s(??/"???/??/?>??/")b'??(':s(??/"???/??/?(??/")b'??)'",
":s(??/"???/??/?)??/")b'??/??/??/??/':f&&s(??/"???/??/?/??/")",
"s(??/"???/??/?/??/")b'??/??/n':if(f)s(??/"???/??/?/n??/")",
"else case'??/"':if(f)s(??/"???/??/?/??/??/??/"??/")",
"else default:c(*p)??>??>??>main()??<char**p",
";t(??/"char*a??(??)=??<??/",0);for(p=a;*p",
";p++)t(*p,1);t(??/"0??>;??/",0);for(p=a",
";*p;p++)t(*p,0);exit(!ferror(o)&&",
"!fclose(o)?EXIT_SUCCESS",
":EXIT_FAILURE);",
"/*NOTREACHED*/",
"??>",
0??>;
??=include<stdio.h>
??=include<stdlib.h>
??=define o stdout
??=define b break;case
??=define s(p)fputs(p,o);
??=define c(p)fputc(p,o);
void t(p,f)char*p;??<f&&c('"')
for(;;p++)??<switch(*p)??<case 0:f&&
s("??/",")c('??/n')return;case
'??=':s("???/?=")b'??<':s("???/?<")
b'??>':s("???/?>")b'??(':s("???/?(")b'??)'
:s("???/?)")b'??/??/':f&&s("???/?/")
s("???/?/")b'??/n':if(f)s("???/?/n")
else case'"':if(f)s("???/?/??/"")
else default:c(*p)??>??>??>main()??<char**p
;t("char*a??(??)=??<",0);for(p=a;*p
;p++)t(*p,1);t("0??>;",0);for(p=a
;*p;p++)t(*p,0);exit(!ferror(o)&&
!fclose(o)?EXIT_SUCCESS
:EXIT_FAILURE);
/*NOTREACHED*/
??>

注: 保存成.C文件VC编译通过.
2006-1-24 01:29
0
雪    币: 233
活跃值: (130)
能力值: ( LV8,RANK:130 )
在线值:
发帖
回帖
粉丝
4
原理就是
call winmain
2006-1-24 11:45
0
雪    币: 247
活跃值: (135)
能力值: ( LV4,RANK:50 )
在线值:
发帖
回帖
粉丝
5
应该都是代码混乱大赛上的作品。
不然谁没事写这种代码
2006-2-1 14:00
0
雪    币: 1852
活跃值: (504)
能力值: (RANK:1010 )
在线值:
发帖
回帖
粉丝
6
严重抗议
请不要刺激我的眼睛
2006-2-1 18:22
0
雪    币: 200
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
7
代码这样编写也有加密的作用,哈哈。
2006-2-1 18:59
0
雪    币: 200
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
8
看多了大脑会比代码还混乱
2006-2-1 19:47
0
雪    币: 217
活跃值: (99)
能力值: ( LV4,RANK:50 )
在线值:
发帖
回帖
粉丝
9
希望有个C/C++代码混乱器,这样任何代码都可以变成这样了.
不知道公开经过混乱的代码是否属于开源

另外上面的代码有大量的问号"?",不知道此符号有何用处.
哪位高手知道呢?
2006-2-1 19:51
0
雪    币: 217
活跃值: (99)
能力值: ( LV4,RANK:50 )
在线值:
发帖
回帖
粉丝
10
似乎有下列对应关系.为什么任何C语言的书上都没介绍这个呢?
??(  <===>  [
??)  <===>  ]
??<  <===>  {
??>  <===>  }
??=  <===>  #
??/  <===>  \

因此把HelloWorld程序写成这样也能正常编译和运行:
??=include<stdio.h>
void main()
{
    char a??(??)="Hello, World!";
    printf(a);
}
2006-2-1 20:00
0
雪    币: 200
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
11
源代码就是供人阅读的,
这样的代码给谁阅读都不方便吧
2006-2-4 14:41
0
雪    币: 272
活跃值: (143)
能力值: ( LV15,RANK:930 )
在线值:
发帖
回帖
粉丝
12
最初由 dwing 发布
似乎有下列对应关系.为什么任何C语言的书上都没介绍这个呢?
??( <===> [
??) <===> ]
??< <===> {
??> <===> }
........

刚刚从 c99-iso-iec 上发现, 原来还是标准
2006-2-7 19:23
0
雪    币: 217
活跃值: (99)
能力值: ( LV4,RANK:50 )
在线值:
发帖
回帖
粉丝
13
最初由 dummy 发布
刚刚从 c99-iso-iec 上发现, 原来还是标准

多谢了,没想到还有比预处理还提前转换的符号.下次写程序时遇到连续两个问号的时候一定要小心了.
如果想打印"??/",还必须转换成"?\?/"才行.
2006-2-7 20:36
0
游客
登录 | 注册 方可回帖
返回
//