PCDVD數位科技討論區

PCDVD數位科技討論區 (https://www.pcdvd.com.tw/index.php)
-   疑難雜症區 (https://www.pcdvd.com.tw/forumdisplay.php?f=34)
-   -   [java] 如何寫會秀出原始碼的程式? (https://www.pcdvd.com.tw/showthread.php?t=594860)

xeonic 2006-02-23 05:38 AM

[java] 如何寫會秀出原始碼的程式?
 
我現在用java寫一個會印出程式本身原始碼的程式
用BufferedReader和FileReader後很簡單的寫了出來
不過後來發現老師說不能用InputStream寫
不知有沒有高手可以指導一下要如何寫?

原題目:
Write a computer program that takes no input (i.e., no command line arguments nor files nor data streams) and outputs its source code. Provide both the source and an output of it running.

Impression 2006-02-23 09:48 AM

這個題目就是要寫出self-reproducing的程式

http://www.nyx.net/~gthompso/quine.htm
這邊有很多範例...


所有的時間均為GMT +8。 現在的時間是02:28 PM.

vBulletin Version 3.0.1
powered_by_vbulletin 2025。