MENU
Question -

Write a function in C + + to count the number of lines present in a text file “STORY.TXT”.



Answer -

void CountLine ()
 {
 ifstream FIL("STORY.TXT");
 int LINES=0;
 char STR[80]; while {FIL.getline(STR, 80);
 LINES++;}
 cout<<"No. of Lines:"<
 f.close();
 }

Comment(S)

Show all Coment

Leave a Comment

Free - Previous Years Question Papers
×