Difference between revisions of "Quine in C"
Jump to navigation
Jump to search
(Created page with "Quine คือ โปรแกรมที่เมื่อรันแล้ว Output จะเหมือนกับ Sourcecode เด๊ะๆ *ลองก๊อบ...") |
(No difference)
|
Latest revision as of 00:17, 8 March 2019
Quine คือ โปรแกรมที่เมื่อรันแล้ว Output จะเหมือนกับ Sourcecode เด๊ะๆ
- ลองก๊อบโค้ดนี้ไปรันดู
- (ต้องเซพเป็นไฟล์ .c นะ เพราะถ้า .cpp จะต้อง include พวก library ก่อน)
- ตัวอย่าง Quine ที่เป็น ANSI-C
[ one invented by AldoCortesi on an idle rainy day ]
int main(void){ char str[]= " int main(void){ char str[]= %c%s%c; printf(str, 0x22, str, 0x22);}"; printf(str, 0x22, str, 0x22);}
- จริงๆภาษาอื่นก็มีนะ แต่ลองก็อบมาให้ดูแค่ภาษา C เฉยๆ -..-