Question: Pile I-CI 'rite a program that asks the user to enter a filename followed by a command. If the user enters the command print. your

Pile I-CI 'rite a program that asks the user to enter a filename followed by a command. If the user enters the command "print". your program should print the contents of the le to the console exactly as it appear in the file. If the user enters the command "double". your program should read each number contained in the file and print the number doubled to a separate line on the console. Ifote: Assume the input file contains only integer numbers separated by a space character. Also assume input file (numbertxt file) contains: 1 2 3 4 5 d 7" S 9 10. You may use the starter code provided: Sample Input-Output: Enter the input file name: c: cpp .' nuinbertxt Enter the command 'print' to print the exact contents of the file to the console. Enter the command 'double' to read each number from the file and print the doubled yalue to the console. Enter the command 'exit' to exit from the program. Please enter a command: print 1 2 3 -1 f7. 6 7- 3 9 10 Enter the command 'print' to print the exact contents of the file to the console. Enter the command 'double' to read each number from the file and print the doubled yalue to the console. Enter the command 'exit' to exit from the program. Please enter a command: double 14916253649643110 Enter the command 'print' to print the exact contents of the file to the console
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
