Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I CANT FIGURE OUT WHY FILE IS NOT OPENING, I DO NOT KNOW what a directory is , ( I tried making sure all files
I CANT FIGURE OUT WHY FILE IS NOT OPENING, I DO NOT KNOW what a directory isI tried making sure all files created dowloaded the numbers doc are in the same folder Also what exactly do i have to do with the numbers.txt file doc? can it be anywhere in the computer and the program should open it Do i have to open the doc within the compiler?
IVE TRIED MULTIPLE codes provided on here and they don't work. Everytime I run, it says "unable to open file" on every code I tried using. ALSO I tried on DEVC and Visual Studio Compilers and neither are working for mewould Also run into the codes having errors
SO PLEASE SINCE I CANNOT COMMENT OR REACH OUT, BE VERY DETAILED on how I should be creating filesprojects and how I should be copying and pasting. PLEASE AND THANK YOU.
Assignment:
Write a program to read the numbers from the text file numberstxt into an unordered linked list. Then do the following task:
Display all the numbers.
Delete all the negative numbers in the list.
Display the new list after deletion.
Ask the user to specify an index of the list, and delete the node by index. I.e If the user types delete the second node of the list. If the user types delete the third node of the list.
Display the new list after deletion.
Bonus:
Ask the user to enter an index and a real number from the keyboard, and insert not replace the real number to the list at the position of the index. I.e If the user types and insert at the third place of the list, and the original third node should become the fourth. There is no partial credit for the bonus. You will get either or
Display the new list after insertion.
Requirements:
You should write a function to delete the negative numbers in the list.
You should write a function to delete the node by index. If the index is less than or if the index is greater than the length of the list, your program should display an error message instead of deleting anything.
Bonus You should write a function to insert a node by index. If the index is less than your program should display an error message instead of inserting anything. If the index is greater than the length of the list, insert the node at the tail of the list.
After you finish your program, compress all your files, including both CPP and HPP into a single ZIP file and upload it to DL
Here is an example of how your program should look like:
The list has the following numbers:
The list after deleting negative numbers is:
Enter the index of the number you want to delete: starting from
The list after the deletion is:
Bonus part:
Enter the index of the number you want to insert: starting from
Enter the number you want to insert:
The list after the insertion is:
Hints:
You can reuse the code in the examples that I uploaded.
You do not have to implement linked list as a class.
If you choose to implement linked list as a class, you may reuse the code in the folder "Linked List implemented as class" on DL
If you choose to implement linked list without a class, you may reuse the code in the folder "Week Linked Lists Part
However, it is recommended that you study the code in both examples.
The code on the textbook does not work for every C compiler. In Dev C you should put this in front of every member variable that unorderedLinkedList has inherited from linkedListType, just like the example I uploaded.
Dont forget to use delete command to free the memory of a node after you delete it from the list.
In the bonus part, dont forget to increase count by after insertion.
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