Question: ---------------------------------------------------- input1.txt: 1 2 3 4 Selection the output should be [1,2,3,4] [1,2,3,4] [1,2,3,4] ---------------------------------------------------- input2.txt is an empty txt file, the output should be

----------------------------------------------------
input1.txt:
1 2 3 4 Selection
the output should be
[1,2,3,4] [1,2,3,4] [1,2,3,4]
----------------------------------------------------
input2.txt is an empty txt file,
the output should be
Input is invalid.
----------------------------------------------------
input3.txt:
40 34 49 13 21 1 3 Insertion the output should be
[34,40,49,13,21,1,3] [34,40,49,13,21,1,3] [13,34,40,49,21,1,3] [13,21,34,40,49,1,3] [1,13,21,34,40,49,3] [1,3,13,21,34,40,49]
----------------------------------------------------
Please answer in c++, thank you.
1. Introduction In this assignment, you will implement sorting methods that you have learned in class on a doubly linked list. 2. Input files This file will contain two lines. The first one gives you the numbers that you have to store in your doubly linked list and the second one will have the sorting method. For instance, this is a valid input: 1582493 Selection This is an invalid input: Insertion 2461 Other examples of invalid input include: empty input, no numbers, no sorting specified 3. Output files - The output file should display the whole linked list after each iteration in the format below. - Each iteration ends when a number sits in its right place and the program starts checking the next number (insertion) or position (selection). [1,5,8,2,4,9,3] [1,2,8,5,4,9,3] [1,2,3,5,4,9,8] [1,2,3,4,5,9,8] [1,2,3,4,5,9,8] [1,2,3,4,5,8,9] If the input is invalid, print: "Input is invalid." (no \ or endl)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
