G
gg
If somebody asks me to write a program that prints itself ( quine ) can
I write the following program as an answer -
#include <iostream>
#include <fstream>
using namespace std;
int main ( void )
{
ifstream self ( __FILE__ );
if ( !self )
{
cerr << " File: " << __FILE__ << "does not exist." << endl;
}
string s;
while ( !self.eof ( ) )
{
getline ( self, s, '\n' );
cout << s << endl;
}
}
I write the following program as an answer -
#include <iostream>
#include <fstream>
using namespace std;
int main ( void )
{
ifstream self ( __FILE__ );
if ( !self )
{
cerr << " File: " << __FILE__ << "does not exist." << endl;
}
string s;
while ( !self.eof ( ) )
{
getline ( self, s, '\n' );
cout << s << endl;
}
}