Forums.Sureshkumar.net : A Perfect Place to Share Knowledge         Blogs     Games    Magazines    

"Sharing knowledge does not lessen your store, often it gets you more. Sharing plays a key role in relationships and bonding, happens in small steps and is assisted through community membership."

Go Back   SURESHKUMAR.NET FORUMS > TECHNICAL DISCUSSIONS > DATA STRUCTURES, C, C++, VC ++ > ds. c , c++ Interview / Technical Questions
Register FAQ Members List Calendar Games Blogs Search Today's Posts Mark Forums Read

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.

   

Reply
 
LinkBack Thread Tools Rate Thread Display Modes
Old 22-06-07, 02:49 PM   #1 (permalink)
Technical GURU
 
BINNY's Avatar
 
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 BINNY has a spectacular aura about BINNY has a spectacular aura about BINNY has a spectacular aura about BINNY has a spectacular aura about
Red face C++ Program Challenge..

hi,

Write a program such tht it prints its own source code as output.
__________________
BINNY
BINNY is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 25-06-07, 01:10 PM   #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 jithendra.b will become famous soon enough
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;
}
jithendra.b is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
The Following User Says Thank You to jithendra.b For This Useful Post:
BINNY (26-06-07)
Old 26-06-07, 12:53 PM   #3 (permalink)
Technical GURU
 
BINNY's Avatar
 
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 BINNY has a spectacular aura about BINNY has a spectacular aura about BINNY has a spectacular aura about BINNY has a spectacular aura about
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
BINNY is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

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


All times are GMT +6.5. The time now is 12:49 PM.





Search Engine Optimization by vBSEO 3.1.0