Question: I need help with this. Make sure the code works and it has no errors. And it is in C + + . In this

I need help with this. Make sure the code works and it has no errors. And it is in C++. In this assignment, you will write a program that inputs a file of int values to a linked list, then print the Option 2- Store input values to a linked list, and print values to output file in sorted order:Opening input file...
Storing values to linked list...
Done reading values from input file.
Enter name of output file: HW04 output.txt
Printing sorted values to output file...
Sorted values printed to HWO4_output.txt.Assignment Details for Option #2:
Your program should ask the user for a filename. This should be the name of an input file which
contains a series of integer values. An example input file is below.
Your program should open the file and store all values to a linked list. Unlike HW#3, the first
number does not represent the number of values within the file. This is information you do not
need when using linked lists. Instead, every number in the file, including the first, should be
stored to your linked list. You can assume there are 1 or more values in the input file.
Ask the user for the name of an output file. This file does not exist yet - your program will create
it.
Print the values to the output file in increasing, sorted order. There are a couple of ways you
could accomplish this:
Add values to the linked list in sorted order - recommended. See class presentation. @
Sort the linked list after all values have been read and added to the list from the file. You
could adapt selection sort to do this. Input and Output Files:
Input files contain a group of integer values.
Unlike HW#3, the first number does not represent the number of values within the file. This is
information you do not need when using linked lists. Instead, every number in the file, including
the first, should be stored to your linked list. You can assume there are 1 or more values in the
input file.
When your program begins reading the file, you will not know how many values are in the file.
Therefore, you can use a while loop that will keep reading until the end of the file is reached. An
example of how to do this is in the File I/O presentation from 10/04.
You can use the below input file to test your program. I will use a different file not listed here to
test your program.
HW04_input.txt
The output file produced by your program may look different depending upon which option you
chose to complete. Below are examples of the output files that would be created based on the
first two options. The option #3 output file would be identical to one of these depending upon
what the user chose to do.
HW04_output_option1.txt
HW04_output_option2.txt
values to an output file in a specific way. You can choose 1 of the 3 options below for completing this
homework. Only provide a solution for 1 of the 3 options - choose which you prefer. Look at example
runs of the 3 different programs below. Details of each option are described afterward.
Option 1- Store input values to a linked list, and print values to output file in reverse order:Opening input file...
Storing values to linked list...
Done reading values from input file.
Enter name of output file: HW04_output.txt
Printing values to output file...
Values printed to HW04_output.txt in reverse order.Assignment Details for Option #1:
Your program should ask the user for a filename. This should be the name of an input file which
contains a series of integer values. An example input file is below.
Your program should open the file and store all values to a linked list. Unlike HW#3, the first
number does not represent the number of values within the file. This is information you do not
need when using linked lists. Instead, every number in the file, including the first, should be
stored to your linked list. You can assume there are 1 or more values in the input file.
Ask the user for the name of an output file. This file does not exist yet - your program will create it.
Print the values to the output file in reverse order. A suggestion: add the values to your linked list
in reverse order from the input files. Instead of adding the next value to the end of the list, add
it to the beginning, and so on. Then, when printing values to your output file, you can start at
the beginning of the linked list and move towards the end.
Note that reverse order does not mean reversed sorted order, just reversed from how the
numbers appear in the input file. For example, if 5 numbers were in the input file: 891302,
then they would be printed to the output file like so: 230198.
I need help with this. Make sure the code works

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 Programming Questions!