Hi! can someone tell me how to count the number of lines?

Recommended Answers

All 3 Replies

If you are using VC++ 2008, then it's so damn easy. Just go to the last character (word or sentence) of your program and then you will see a grey vertical bar. Click on it and a dark red balloon will appear, right click on it and then click on "Location", which will show you the location of that line and if you have several files, do the same with them all and then add the lines, there you are!

hehe,

To the original poster.

Maybe you should clarify a little,
what it is that you want.

Hi! can someone tell me how to count the number of lines?

I suppose you mean the number of lines in a file??? create an int variable and initialize it to 0. Open the file. Set up a loop to read the file one line at a time using getline() then increment the counter variable on each loop iteration.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.