| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 3298 人关注过本帖
标题:[原创]一个混乱代码的程式
只看楼主 加入收藏
Knocker
Rank: 8Rank: 8
等 级:贵宾
威 望:47
帖 子:10454
专家分:603
注 册:2004-6-1
结帖率:92.86%
收藏
 问题点数:0 回复次数:9 
[原创]一个混乱代码的程式

这个是我的最初版本,容易看懂。

win-tc 1。8下编译通过(把所有的代码放在一行),运行结果就是原程式,拷贝到编译器同样还可以运行。

其它编译器加上头文件。

char*s="main(){char*t;t=s;printf(\"char*s=\\\"\");while(*s){if (*s==92||*s==34)p rintf(\"\\\\\");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++);}

[此贴子已经被作者于2004-06-18 14:05:09编辑过]

搜索更多相关主题的帖子: 程式 代码 
2004-06-18 13:48
Knocker
Rank: 8Rank: 8
等 级:贵宾
威 望:47
帖 子:10454
专家分:603
注 册:2004-6-1
收藏
得分:0 

其实写写这种代码也很有意思的,不知道有人感兴趣吗?交流交流。

如果加上精巧的计算,可以加密原文,每一次的运行结果可以有不同的图案变化,而且结果都是可以再次运行,也就是一个完整的程序。


九洲方除百尺冰,映秀又遭蛮牛耕。汽笛嘶鸣国旗半,哀伤尽处是重生。     -老K
治国就是治吏。礼义廉耻,国之四维。四维不张,国之不国。   -毛泽东
2004-06-18 13:56
hu_sir
Rank: 1
等 级:新手上路
帖 子:208
专家分:0
注 册:2004-4-29
收藏
得分:0 
确实好帖
少见的好帖
真 TMD 好帖
难得一见的好帖
千年等一回的好帖
好得不能再好的好帖
惊天地且泣鬼神的好帖
让人阅毕击掌三叹的好帖
让人佩服得五体投地的好帖
让人奔走相告曰须阅读的好帖
让斑竹看后决定加精固顶的好帖
让人看后在各论坛纷纷转贴的好帖
让人看后连成人网站都没兴趣的好帖
让人看完后就要往上顶往死里顶的好帖
让人看后不断在各种场合重复引用的好帖
让人一见面就问你看过某某好帖没有的好帖
让人半夜上厕所都要打开电脑再看一遍的好帖
让个读过后都下载在硬盘里详细研究欣赏的好帖
让人走路吃饭睡觉干什么事连做梦都梦到它的好帖
让人翻译成36种不同外语流传国内外世界各地的好帖
让人纷纷唱道过年过节不送礼要送就送某某帖子的好帖
让国家领导人命令将该帖刻在纯金版上当国礼送人的好帖
让网络上纷纷冒出该帖的真人版卡通版搞笑版成人版的好帖
让人在公共厕所里不再乱涂乱化而是纷纷对它引经据典的好帖
让某位想成名的少女向媒体说她与该帖作者发生过性关系的好帖
让人根据它写成小说又被不同导演拍成48个不同版本的电影的好帖
让某名导演跟据此帖改拍的电影在奥斯卡上一连拿了11个奖项的好帖
让人大代表们看完后联名要求根据该帖的内容对宪法做适当修改的好帖
让人为了谁是它的原始作者纷纷地闹上法院打官司要争得它的版权的好帖
让各大学府纷纷邀请该帖作者去就如何发表优秀网络文学为题目演讲的好帖
让人为了该帖而成立了各种学会来研究并为不同的理解争得眼红脖子粗的好帖
让美国警察于今后逮捕人说你有权保持沉默还有权阅读某某帖子要不要啊的好帖
让本拉登躲在山洞里还命令他手下冒着被美军发现的危险去上网下载来阅读的好帖
让萨达姆被捕时被发现他随身携带的除了一把手枪之外还有的就是它的复印件的好帖
让比尔盖茨在懂事会上发给与会者人手一份该帖命令仔细阅读后才讨论其他事宜的好帖
让诺贝儿奖理事会破天荒地因该帖的出现而开会讨论一直决定今后设立最佳帖子奖的好帖
让联合国安理会决定将它译成宇宙语由中国神州六号升空后不断播放看有没有外星人的好帖
让人看完后IE锁死连瑞星诺顿都没法修复只好格式化硬盘重装启动后主页显示的还是它的好帖
2004-06-18 16:48
xinwu
Rank: 1
等 级:新手上路
帖 子:29
专家分:0
注 册:2004-6-19
收藏
得分:0 
最好不要有这样的编程风格。

我永远相信数目,逻辑能带来理由!
2004-06-19 17:57
jiely
Rank: 1
等 级:新手上路
帖 子:106
专家分:0
注 册:2004-5-15
收藏
得分:0 
hehe

我的爱好:C和数据库!正在学VC++ 我的QQ:345895839,有共同爱好的加我!期待着与你共同进步!
2004-06-19 18:44
ant3000
Rank: 1
等 级:新手上路
帖 子:188
专家分:0
注 册:2004-6-7
收藏
得分:0 
我同意楼上的意见  编写代码不要花巧 你能看懂不代表别人看得懂 就算能看懂也要一段时间 这样的代码在公司是不允许的
2004-06-19 18:49
Knocker
Rank: 8Rank: 8
等 级:贵宾
威 望:47
帖 子:10454
专家分:603
注 册:2004-6-1
收藏
得分:0 
哈,有没有听说过混乱代码大赛?

九洲方除百尺冰,映秀又遭蛮牛耕。汽笛嘶鸣国旗半,哀伤尽处是重生。     -老K
治国就是治吏。礼义廉耻,国之四维。四维不张,国之不国。   -毛泽东
2004-06-19 19:37
Knocker
Rank: 8Rank: 8
等 级:贵宾
威 望:47
帖 子:10454
专家分:603
注 册:2004-6-1
收藏
得分:0 

这个又有谁能看懂?

#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);}

不要以为是乱码啊


九洲方除百尺冰,映秀又遭蛮牛耕。汽笛嘶鸣国旗半,哀伤尽处是重生。     -老K
治国就是治吏。礼义廉耻,国之四维。四维不张,国之不国。   -毛泽东
2004-06-19 23:41
Knocker
Rank: 8Rank: 8
等 级:贵宾
威 望:47
帖 子:10454
专家分:603
注 册:2004-6-1
收藏
得分:0 
国际C代码混乱大赛

  “国际C代码混乱大赛”起始于1984年。一位程序员在看了4.2BSD里的Bourne Shell的源代码后感叹道:“天哪!这太恐怖了!”于是他在USENET的新闻组上提出,如果程序员故意将代码写得乱七八糟,那么代码究竟能乱成什么模样?[主办者的介绍]遂就举办了第一届“C代码混乱大赛”。那一届的规则很简单,就是在512字节内,最大程度的写出混乱但是可以顺利编译的完整C代码。之后,这项比赛持续举办了下去。由于是在互联网上举办的,所以参加人数众多,范围也很广。终于它变成了今天的“国际C代码混乱大赛”,并且成为众“黑客”们一展编程功力和与众不同的想象力的舞台。

下面是历年的获奖作品。

年代 文件名 概要
1984 anonymous decot laman mullender prints hello world, where read is write prints garbage, weird cpp defines (keywords for others) prints spiralling numbers, laid out in columns hardcoded vax and pdp-11 code to move :-) across the screen
1985 applin august lycklama shapiro sicherman one-liner to print hello world, with execlp cpp obfuscated, compressed, main-recursive primes in binary heavily cpped with o_oo identifiers, scrolls text right two defines, one 7-liner, results in a maze rot13 with strange #defs that create comment headers etc.
1986 applin august bright hague holloway marshall pawka stein wall hello world works under cc, /bin/sh, and f77 struct-heavy e-computation, memory allocation with sbrk hex dump, cpp compressed, uses lost of << for constants morse code filter written with 'DIT DAH _DIT DIT_DAH' prints hello world! via a recursive main train engine-shaped program prints "choo choo" prints 'obfuscated?' big, uses xyyyx idents... prints HHMMSS in UTC time dvorak keyboard emulator
1987 biggar heckbert hines korn lievaart wall westley program: "P;" defined on command line obfuscated fold program counts goto's, all ids anagrams of 'goto', all flow w goto one-liner that prints a message on a Un*x system very good othello player roman numeral -> decimal and vice versa conversion individually palindromic lines prints a palindrome
1988 applin dale isaak litmaath phillipps reddy robison spinellis westley massive #define stuff, includes itself; prints table of primes prints command line, using lots of system calls table driven table of the elements; cpp, self-inclusion sorts each arg using only argc, argv, and 'while(<cond>);' 'first day of christmas', tables, heavily main() calling prints name of 'char *(*(foo[16])();', compressed print e in any base, uses only --, >=, and while() #include "/dev/tty" prints '3.141', circle made of '_-_-_-_' in layout
1989 fubar jar.1 jar.2 ovdluhe paul robison roemer tromp vanb westley self-reconstructing, recompiling factorial program char*_="Hello world.\n"; lisp interpreter, compressed monkey-typer following template, 'APE' identifiers print fibonacci base 2 by simulating turing machine apl-expression interpreter (binary), written in C-- prints e, script-pi shaped layout, _31415 identifiers squished tetris one-liner prints all subsets of arguments reversible, rot13able program that reverses and/or rot13s.
1990 baruch cmills dds dg jaw pjr scjones stig tbr theorem westley short prog to solve N-queens problem squished blackjack game basic interpreter, heavily compressed rot13 done with strange cpp macros compress & atob standins the quick brown fox... cppd, structs of functions trigraph-abusing self-reproducing program nested-comment tester (all on command line) simple compressed shell, silly layout numerically solves the equation y'=f(x,y) poetic exchange between lovers, prints "luvs me, luvs not"
1991 ant brnstnd buzzard cdupont davidguy dds fine rince westley compressed vi-like editor sorta stack language walk thru a maze from a first person point of view prints a message without vowels plays life on a root window, doesn't need Xlib or include files basic compiler, heavily compressed rot13s lines of input game with sprites, boulders, dimonds, and keys plays tic-tac-toe, compile output for next move, prints board
1992 adrian albert ant buzzard.1 buzzard.2 gson imc kivinen lush marangon nathan vern westley grep-like utility using a state machine transition language factors multi-precision numbers with factors < MAX_LONG make utility print factorial, gcd or prime test using a Babbage-like engine forth-like stack machine anagram generator Mandelbrot/Julia drawer X11 space invaders, dropout and knockout games prints "Hello, World" using error messages game to balance a grid of digits to all 5's obfuscation by (trivial) encryption (source not exported) plays chess print ASCII world map and mark a location by lat/long
1993 ant cmills dgibson ejb jonth leo lmfjyh plummer rince schnitzi vanb egrep utility with Posix-like documentation X11 program that shatters and bounces windows plays the game of like using cpp tower of Hanoi and patience pizzle game of Tetris game of mastermind (cows & bulls) source is the filename, prints value of __FILE__ prints numbers up to a given value game state machine language, comes with a number of games answers questions about English text in a file calculator that prints in octal
1994 dodsond1 dodsond2 horton imc ldb schnitzi shapiro smr tvr weisberg westley plays a game of othello Hunt the Wumpus (gziped source) Plot cubic equations on a tty print a random n by n magic square print a random line from stdin flips stdin along a diagonal (source mirrored along diagonal) print time of day on an tty world's smallest self reproducing program interactive fractals for the X Window System prints prime numbers Adventure/Dungeon like game played via the C pre-processor
1995 cdua dodsond1 dodsond2 esde garry heathbar leob makarios savastio schnitzi spinellis vanschnitz Generate a maze on the scren and then solve it Text to "Pig Latin" translator Interactive 3D Maze Searches for words in a file which have the same Soundex code Environment-expansion and binary output via escaped env vars 16 bit addition the easy/hard way Output interesting patterns and cycles in PostScript Emits the base 8 representation of prime palindromic in base 8 Infinite-precision factorial calculator Find divisors: where a core dump is a feature, not a bug Abusing the rules Towers of Hanoi via the C pre-processor
1996 august dalbec eldby gandalf huffman jonth rcm schweikh1 schweikh2 schweikh3 westley Subset of C compiler and byte code interpreter Generator of strong probable-primes to a given base Flying 3D spheres in an ASCII display Displays the ASCII and 8 bit character tables Braille to ASCII and vice versa X based dual player tic-tac-toe game Gunzip equivalent Calculates Easter dates from 1582 to 2199 AD Search for a limited class of expressions that equal a constant Determins the memory allocation honesty of the OS Shows the time on clock with a configurable face and style
1997 ---- There is no contest in this year.
1998 banks bas1 bas2 chaos df dlowe dloweneil dorssel fanf schnitzi schweikh1 schweikh2 schweikh3 tomtorfs A flight simulator! Outputs a gziped 3D beam maze in Postscript determines the size of stdin under IOCCC sizing rules Rotates and zooms an object using ASCII graphics A word guessing game Pootifies stdin (useful to view Microsoft html files) A very addictive ASCII poot game ASCII / Morse code translator Translates Lambda expressions into combinator expressions Prints a C program that sorts arguments using strange functions Tests to see if your compiler and headers are standard Prints random 0's and 1's; causes some gcc's as passes to choke Finds duplicate files that waste disk space CRC generator
1999 ---- There is no contest in this year,too.
2000 anderson bellard bmeyer briddlebane dhyang dlowe jarijyrki natori primenum rince robison schneiderwent thadgavin tomx ASCII to semaphore code convertor Prints M6972593 (2^6972593-1) by Modular Fast Fourier Transform An image compressor Verbally abuses the user Saitou Hajime image that prints a prog that prints a prog ... A dc-style calculator that uses embedded Perl An X-based spreadsheet program with graphing features! Phase of the moon Source with English words that looks like a prime tester Plots the positions of the four Galilean moons of Jupiter Highly Compressed Program for Playing Hygienic Checkers Prints the aproximate time in words Prints a dazzeling moving image under multiple interfaces C source, shell program and Makefile
说明:   以上程序请在Unix环境下编译,或使用GCC核心编译器,例如 Dev-C++ 编译器。   Makefile文件

最后补充一句——千万不要在自己的代码中这样做,除非你报名参加这项比赛!


九洲方除百尺冰,映秀又遭蛮牛耕。汽笛嘶鸣国旗半,哀伤尽处是重生。     -老K
治国就是治吏。礼义廉耻,国之四维。四维不张,国之不国。   -毛泽东
2004-06-20 10:43
xing_yufei
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2010-11-11
收藏
得分:0 
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++);
        getchar();
}
2010-11-11 08:52
快速回复:[原创]一个混乱代码的程式
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.410872 second(s), 9 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved