subject

Write a program that allows the user to navigate the lines of text in a file. The program should prompt the user for a filename and input the lines of text into a list. The program then enters a loop in which it prints the number of lines in the file and prompts the user for a line number. Actual line numbers range from 1 to the number of lines in the file. If the input is 0, the program quits. Otherwise, the program prints the line associated with that number.
It should be like as this sample run follows.

Enter the input file name: quotes. xtxt
I cannot open the file quotes. xtxt - Please check the name and try again.
Enter the input file name: quotes. txt
The file has 16 lines.
Enter a line number [0 to quit]: 1
1: Hakuna Matata!
Enter a line number [0 to quit]: -1
Try again. Line number must be between 0 and 16
Enter a line number [0 to quit]: 16
16: Just keep swimming!
Enter a line number [0 to quit]: 17
Try again. Line number must be between 0 and 16
Enter a line number [0 to quit]: 5
5: It's kind of fun to do the impossible.
Enter a line number [0 to quit]: A
Try again. Please enter a number between 0 and 16
Enter a line number [0 to quit]: $
Try again. Please enter a number between 0 and 16
Enter a line number [0 to quit]: 4
4: To infinity and beyond!
Enter a line number [0 to quit]: 0

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 16:50
3.2.5 suppose that we have an estimate ahead of time of how often search keys are to be accessed in a bst, and the freedom to insert items in any order that we desire. should the keys be inserted into the tree in increasing order, decreasing order of likely frequency of access, or some other order? explain your answer.
Answers: 1
question
Computers and Technology, 22.06.2019 16:00
You have inserted new slides based on a word outline. how do you format these new slides to match the powerpoint presentation formatting? a. select all slides in the presentation and click format on the home tab. b. select the new slides and click reset on the home tab. c. select all slides in the presentation and click reset on the home tab. d. select the new slides and click format on the home tab.
Answers: 3
question
Computers and Technology, 23.06.2019 02:00
Which demographic challenge is europe currently experiencing? a. an aging and decreasing population b. a baby boomc. an unequal distribution between males and females d. a large group of teenagers moving through the school system(i chose a but i'm unsure)
Answers: 1
question
Computers and Technology, 23.06.2019 14:00
What is html ? give a small description about html
Answers: 2
You know the right answer?
Write a program that allows the user to navigate the lines of text in a file. The program should pro...
Questions