Go Back   Armenian Knowledge Base > Technical sections > Languages, Compilers, Interpreters

Reply
 
Thread Tools

for code geeks :-)
Old 20.08.2005, 13:43   #1
4294967296
 
Boyov's Avatar
 
Join Date: 03 2002
Location: /proc/1
Age: 40
Posts: 379
Rep Power: 0
Default for code geeks :-)

Could somebody write a program on c++ (using only 'cout') which will print it's own source code ?
__________________
Free your mind and your OS will follow

Old 20.08.2005, 15:36   #2
Профессор
 
Nikita's Avatar
 
Join Date: 01 2005
Location: Perm
Age: 46
Posts: 2,142
Rep Power: 0
Default

А ты мог бы показать множестнво которое содержит само себя ?

Old 24.09.2019, 16:39   #3
Ego coder
 
AvDav's Avatar
 
Join Date: 07 2004
Location: Yerevan, Armenia
Age: 44
Posts: 3,738
Rep Power: 5
Default

Code:
#include <string>
#include <fstream>
#include <iostream>

int main(int argc, char* argv[])
{
	std::string s;
	std::ifstream ifs(__FILE__);
	while(!ifs.fail()) {
		std::getline(ifs, s);
		std::cout << s << std::endl;
	}
	return 0;
}
__________________
Каждый сам кузнец своего счастья, и несчастья тоже.
Reply




Реклама:
реклама
Buy text link .

All times are GMT. The time now is 01:44.
Top

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.