Help me with writing a simple C++ program

Status
Not open for further replies.

NTFS

Member level 3
Joined
Apr 6, 2004
Messages
66
Helped
1
Reputation
2
Reaction score
0
Trophy points
1,286
Activity points
565
challenge: self writer

Hi all

My teacher gave an exercise that I need your help to solve it.

we have to write a program in C++ that print itself (source code).
I mean, the two following commands should have same output:

1) myprog.exe

2) type myprog.cpp

we can't use stream or another file, just we can use C++ instructions like: for , if and etc.

Please guide me to solve it.

Thanks in advance.
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…