Question: This program numbers the lines found in a text file. Write a C++ program that reads te from a file and outputs each line to

 This program numbers the lines found in a text file. Write

This program numbers the lines found in a text file. Write a C++ program that reads te from a file and outputs each line to the screen preceded by a line number. Print the lin number at the start of the line and right-adjusted in a field of three spaces. Follow the line number with a colon, then one space, then the text of the line. You should get a character at a time so you will not modify the content. You may assume that the lines are short enough to fit within a line on the screen. I am Sample input file: With three or four loggerheads amongst three or four score hogsheads. I have sounded the very base-string of humility. Sirrah, sworn brother to a leash of drawers; and can call them all by their christen names, as Tom, Dick, and Francis. They take it already upon their salvation, that though I be but the prince of Wales, yet I am king of courtesy; and tell me flatly I am no proud Jack, like Falstaff, but a Corinthian, a lad of mettle, a good boy, by the Lord, so they call me, and when I am king of England, I shall command all the good lads in Eastcheap. Sample screen output: 1: With three or four loggerheads amongst three or four 2: score hogsheads. I have sounded the very 3: base-string of humility. Sirrah, I am sworn brother 4: to a leash of drawers; and can call them all by 5: their christen names, as Tom, Dick, and Francis. 6: They take it already upon their salvation, that 7: though I be but the prince of Wales, yet I am king 8: of courtesy; and tell me flatly I am no proud Jack, 9: like Falstaff, but a Corinthian, a lad of mettle, a 10: good boy, by the Lord, so they call me, and when I 11: am king of England, I shall command all the good 12: lads in Eastcheap

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!