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

I NEED HELPS!!!!

Recommended Answers

All 2 Replies

I guess you're not familiar with this forum, so I'll just refer you here.

commented: Thank You For Your Help +0

I guess you're not familiar with this forum, so I'll just refer you here.

thank you

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.