| Forums.Sureshkumar.net : A Perfect Place to Share Knowledge Blogs Games Magazines |
|
|||||||
| ds. c , c++ Interview / Technical Questions Kindly solve an many as questions you can. It will sharpen your skills and those solutions will help others too. |
![]() |
|
|
LinkBack | Thread Tools | Rate Thread | Display Modes |
|
|
#1 (permalink) |
|
Technical GURU
Join Date: Feb 2006
Location: India
Posts: 805
Thanks: 4 Thanked 19 Times in 15 Posts Thanks: 4
Thanked 19 Times in 15 Posts
Blog Entries: 2
Rep Power: 14
|
hi,
Write a program such tht it prints its own source code as output.
__________________
BINNY
|
|
|
|
|
|
#2 (permalink) |
|
Senior Member
Join Date: Oct 2006
Location: In Bangalore
Age: 24
Posts: 126
Thanks: 1 Thanked 6 Times in 6 Posts Thanks: 1
Thanked 6 Times in 6 Posts
Rep Power: 0
|
Re: C++ Program Challenge..
#include<iostream.h> //Includes the standard input and output streams
using namespace std; //defines the scope of the identifiers. int main() { FILE *fp; fp = fopen("file.txt","r"); //file.txt is the name of the current file while((ch = getc(fp))!=EOF) { putc(ch,stdout); } return 0; } |
|
|
|
| The Following User Says Thank You to jithendra.b For This Useful Post: |
BINNY (26-06-07)
|
|
|
#3 (permalink) |
|
Technical GURU
Join Date: Feb 2006
Location: India
Posts: 805
Thanks: 4 Thanked 19 Times in 15 Posts Thanks: 4
Thanked 19 Times in 15 Posts
Blog Entries: 2
Rep Power: 14
|
Re: C++ Program Challenge..
I have modified the above program to rectify some errors.. here is the perfectly working program ..Thnks for the logic
Code:
#include<iostream.h> //Includes the standard input and output streams
#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
FILE *fp;
fp = fopen("TEST.CPP","r"); //file.txt is the name of the current filec
char ch;
while((ch = getc(fp))!=EOF)
{
putc(ch,stdout);
}
getch();
}
__________________
BINNY
|
|
|
|
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Fresh College Graduates @ Microsoft India - Microsoft It Apex Program | sridhar | FRESHER JOBS | 0 | 02-04-07 12:01 PM |
| Employee Referral Program - Special Scheme -SAP Consultants | sridhar | FRESHER JOBS | 0 | 15-03-07 04:21 PM |
| Student Project Program - Microsoft Academic Project Program 2006-2007 | jasmine84 | Other Requirements | 0 | 26-01-07 07:47 PM |
| Plz hELP ME I NEED THE o/p of the following Program | ashirvad | DATA STRUCTURES, C, C++, VC ++ | 2 | 23-09-06 12:08 AM |
| Want code for the program | vindows_k | DATA STRUCTURES, C, C++, VC ++ | 0 | 28-03-06 10:12 PM |