win-tc 1。8下编译通过(把所有的代码放在一行),运行结果就是原程式,拷贝到编译器同样还可以运行。
其它编译器加上头文件。
char*s="main(){char*t;t=s;printf(/"char*s=///"/");while(*s){if (*s==92||*s==34)printf(/"/");printf(/"%c/",*s++);}printf(/"///";/");while(*t)printf(/"%c/",*t++);}";main({char*t;t=s;printf("char*s=/"");while(*s){if (*s==92||*s==34)printf("//");printf("%c",*s++);}printf("/";");while(*t)printf("%c",*t++);}
简化一下:
char*s=
"# include /"stdio.h/" "
" int main(void) "
" { "
" char*t; "
" int i=0; "
" t=s; "
" "
" printf(/"char*s=//n///"/"); "
" while(*s) "
" { i++; "
" if(!(i%45))printf(/"///"//n///"/"); "
" if (*s==92||*s==34)printf(/"/"); "
" printf(/"%c/",*s++); "
" } "
" printf(/"///";//n/"); "
" i=0; "
" while(*t) "
" { i++; "
" if(!(i%45))printf(/"//n/"); "
" printf(/"%c/",*t++); "
" } "
" "
" } ";
# include "stdio.h"
int main(void)
{
char*t;
int i=0;
t=s;
printf("char*s=/n/"");
while(*s)
{ i++;
if(!(i%45))printf("/"/n/"");
if (*s==92||*s==34)printf("//");
printf("%c",*s++);
}
printf("/";/n");
i=0;
while(*t)
{ i++;
if(!(i%45))printf("/n");
printf("%c",*t++);
}
}
还有一个刚学到的版本:
#include<stdio.h> main(_){printf(_,10,34,_="#include<stdio.h>%cmain(_){printf(_,10,34,_=%c%s%c,34);}",34);} |