sign up I login
 advanced
refer a friend - earn nickels!!

Ask & Discuss Questions with Community & Experts

Moderation Team
 90 chars left    advanced
Ask iit jee aieee pet cbse icse state board community Community Discussion Question: please guys help me with dis c++ question
Forum Index -> General Knowledge like the article? email it to a friend.  
Author Message
Vincent (24)

Hot goIITian

Olaaa!! Perrrfect answer. 4  [6 rates]

Vincent's Avatar

total posts: 140    
offline Offline
Write a program to read the text file "NAMES.TXT" that contents students's names and display them on the console along with lengh of every name present in the file .

The one man Dynasty !!!!!!!!

    
Aatish (2323)

Blazing goIITian

Olaaa!! Perrrfect answer. 417  [536 rates]

Aatish's Avatar

total posts: 1103    
offline Offline
gimme 5 minutes..........

............................................................................................................................................................................................
There's Light at the end of every Tunnel, so KEEP MOVING....
Best of luck to all my mates....
............................................................................................................................................................................................
 this reply: 0 points  (with Olaaa!! Perrrfect answer.   in 0 votes )   [?]
 
You have to be logged on to rate
  
Aatish (2323)

Blazing goIITian

Olaaa!! Perrrfect answer. 417  [536 rates]

Aatish's Avatar

total posts: 1103    
offline Offline
#include<fstream.h>
#include<conio.h>
#include<string.h>
void main()
{
fstream ob ( "NAMES.TXT" , ios::in|ios::out);

char str[50];
int len;

while ( ! ob.eof () )
{
    ob.getline( str , 50 ) ;
    len = strlen ( str );
   
       if ( !ob.eof() )
        {
       cout<<" The string is : "<<str<<endl;
       cout<<" The length of string is : "<<len<<endl;  
        }
}

ob.close();
getch();
}




this should work ........if not then do let me know.......


............................................................................................................................................................................................
There's Light at the end of every Tunnel, so KEEP MOVING....
Best of luck to all my mates....
............................................................................................................................................................................................
 this reply: 10 points  (with Olaaa!! Perrrfect answer.   in 2 votes )   [?]
 
You have to be logged on to rate
  
Vincent (24)

Hot goIITian

Olaaa!! Perrrfect answer. 4  [6 rates]

Vincent's Avatar

total posts: 140    
offline Offline
I also think the same . But after cout you put two double quotes .he he lol.. gr88888 job .

The one man Dynasty !!!!!!!!

 this reply: 0 points  (with Olaaa!! Perrrfect answer.   in 0 votes )   [?]
 
You have to be logged on to rate
  
Aatish (2323)

Blazing goIITian

Olaaa!! Perrrfect answer. 417  [536 rates]

Aatish's Avatar

total posts: 1103    
offline Offline
ahhh yea.....in a hurry........now edited.......

............................................................................................................................................................................................
There's Light at the end of every Tunnel, so KEEP MOVING....
Best of luck to all my mates....
............................................................................................................................................................................................
 this reply: 0 points  (with Olaaa!! Perrrfect answer.   in 0 votes )   [?]
 
You have to be logged on to rate
  
 
Forum Index -> General Knowledge
Go to:   

 Aakash Institute IIT/ AIEEE/ Medical Crash Course
Name  
E-mail  
Phone  
Mobile  
** Hurry. Exclusive goIIT Offer. Limited Seats Only!
available in: New Delhi, Amritsar, Bhatinda, Bokaro, Chandigarj, Dehradun, Guwhati, Hyderabad, Indore, Jaipur, Kanpur, Karnal, Kolkata, Kota, Lucknow, Ludhiana, Mumbai, Noida, Patiala, Patna, Pune, Ranchi, Varanasi
Top Offers for goIITians
Correspondence Courses
Brilliant Tutorials
Narayana Institute
Aakash Institute
Classroom/Crash Courses
Aakash-IITJEE : AIEEE
Aakash-IITJEE : DCE
Aakash-IITJEE : MHTCET
Aakash Institute : AIPMT
Online Test Series
Brilliant Tutorials
Narayana Institute
Aakash Institute
Mahesh Tutorials
AMITY      Sri Chaitanya