Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Pls use C/C++ to answer this question. Your program should run on a command window and do the following: Print out the following message on
Pls use C/C++ to answer this question.
Your program should run on a command window and do the following: Print out the following message on the console: Input 5 integers separated by spaces: (The user will type 5 integers, such as 1 2 3 4 5, and then hit 'Enter') Your code will print out on the console the user-input integers in reversed order (If the input is '1 2 3 4 5', this step should print '5 4 3 2 1' on the screen) Print out the following message on the console: Input a text file name: (The user will type a file name, with the file being a text file in the current working folder, e.g., test01.txt) Your code will then read the first 5 words (space separated) from the given file, and then print all the 5 words on the console. (For this part, you should create a text file to test your code.) In addition, your code should perform the following basic error handling: if a user input file is non-existent in Step (3), your code should report that and ask for the user to input another file name (e.g., print on the screen 'File not found: please input another file name'), until a file with the input name can be found in the current working folder, then move on to Step (4)Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started