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

好乱的代码.....

2006-1-24 00:28
5868
#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.

[培训]《安卓高级研修班(网课)》月薪三万计划,掌 握调试、分析还原ollvm、vmp的方法,定制art虚拟机自动化脱壳的方法

收藏
点赞0
打赏
分享
最新回复 (12)
雪    币: 217
活跃值: (99)
能力值: ( LV4,RANK:50 )
在线值:
发帖
回帖
粉丝
dwing 1 2006-1-24 01:22
2
0
VC可以编译,只不过有6个warnings.
雪    币: 217
活跃值: (99)
能力值: ( LV4,RANK:50 )
在线值:
发帖
回帖
粉丝
dwing 1 2006-1-24 01:29
3
0
我也发一个,这个程序可以打印自身
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编译通过.
雪    币: 233
活跃值: (130)
能力值: ( LV8,RANK:130 )
在线值:
发帖
回帖
粉丝
南蛮妈妈 3 2006-1-24 11:45
4
0
原理就是
call winmain
雪    币: 240
活跃值: (130)
能力值: ( LV4,RANK:50 )
在线值:
发帖
回帖
粉丝
phoenix[ne] 1 2006-2-1 14:00
5
0
应该都是代码混乱大赛上的作品。
不然谁没事写这种代码
雪    币: 1852
活跃值: (504)
能力值: (RANK:1010 )
在线值:
发帖
回帖
粉丝
北极星2003 25 2006-2-1 18:22
6
0
严重抗议
请不要刺激我的眼睛
雪    币: 200
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
天涯小浪 2006-2-1 18:59
7
0
代码这样编写也有加密的作用,哈哈。
雪    币: 200
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
sparkif 2006-2-1 19:47
8
0
看多了大脑会比代码还混乱
雪    币: 217
活跃值: (99)
能力值: ( LV4,RANK:50 )
在线值:
发帖
回帖
粉丝
dwing 1 2006-2-1 19:51
9
0
希望有个C/C++代码混乱器,这样任何代码都可以变成这样了.
不知道公开经过混乱的代码是否属于开源

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

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

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

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