hi...
got a programming assignment which really makes my brain bleed...all threads gives answers on how to access a text file and display text from that source. what i really need is the code in which i would get the text from every single line inside the text file. for example, the text file's data is like this:

109-2033, Johnny Gil
109-2034, Johnny Depp
109-2035, Johnny John
109-2036, Johnny doe

i need the code which will give me this output:

line 1: 109-2033, Johnny Gil
line 2: 109-2034, Johnny Depp
line 3: 109-2035, Johnny John
line 4: 109-2036, Johnny doe

i hope someone could help me out asAp...i'll be forever grateful...thanks

What have you tried so far?

Hint: use the getline function

Member Avatar for iamthwee

And an incremental counter.

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.