GeekInterview.com
   Home |  Tech FAQ  |   Interview Questions |  Placement Papers |  Tech Articles |  Learn |  Freelance Projects |  Online Testing |  Geeks Talk |  Job Postings |  Knowledge Base | Site Search |  Add/Ask Question

  GeekInterview.com  >  Interview Questions  >  Programming  >  C++

 Print  |  
Question:  How do you write a program which produces its own source code as its output?



January 01, 2007 08:02:18 #4
 Ashish   Member Since: Visitor    Total Comments: N/A 

RE: How do you write a program which produces its own ...
 
include<iostream>
#include<fstream>
using namespace std;
int main()
{
             fstream *obj = new fstream();
             obj->open ("main.cpp"); // file path
              cout<<obj->rdbuf();
              return 0;

}
     

 

Back To Question