Write a C++ program that ask the user for the name of a file. The program must have a function that prompt the user to enter a file name and open the file. The program should display the last ten lines of the file on the screen. Each line of screen output should be preceded with a line number, followed by a colon.

The line numbering should reflect the real line numbers. If the file has fewer than 10 lines, the entire file should be displayed, with a message indicating the entire file has been displayed.
An output example:
25: this is line 25;
26: this is line 26;
27: this is line 27;
28: this is line 28;
29: this is line 29;
30: this is line 30;
31: this is line 31;
32: this is line 32;
33: this is line 33;
34: this is line 34


7 Years
Discussion Span
Last Post by xxunknown321
Featured Replies
  • I guess you're not familiar with this forum, so I'll just refer you [URL="http://www.daniweb.com/forums/announcement8-2.html"]here[/URL]. Read More

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.