(fwd) self-printing program - Reply
- Posted by "BABOR, JIRI" <J.Babor at GNS.CRI.NZ> May 07, 1998
- 521 views
Andy Kurnia relayed: >>Subject: self-printing program >> >>This doesn't really seem like an olympiad-style problem, but it's an >>interesting programming challenge anyway... >> >>The basic problem is simple: Write a completely self-contained program >>that prints out its own source code. >> >>A couple guidelines: >> * You can use practically any modern programming language--C, Pascal, >> Perl, etc. >> * Your program should be as short as possible. >> * By "self-contained", I mean the program shouldn't access any >> external storage. (This also means that once compiled, the program >> should work even if the original source code is discarded.) 1. It sort of disqualifies all interpreted (only) languages. 2. More importantly, how do you print the source you have already discarded? And, please, don't tell me you are supposed to keep it in an internal string... Jiri