+ 1

Can anyone solve this assignment for me please?? I am a beginner

Write a C program to create and manipulate a one dimensional array (list) of up to a hundred sorted ( ascending order) numbers by using functions to insert, remove, or print elements as follows: - Function insert : will search for the appropriate position of a given element and if the element is already in the list will display an error message. If not, the function will shift all the elements starting from the position of the element to the right of the array and then insert the element into that position. - Function remove: will search for the element to be removed and if not found will display an error message. If the element exists, the function will remove it and shift all the elements that follow it to the left of the array. - Function print: will print the elements that exist in the array at that point. Your program should display a menu to the user that allows him/her to insert, remove, or print as many elements as they want until they want to stop. If an element is inserted into an already full list, an error message should be displayed. The array (list) at the beginning should be empty.

21st Apr 2019, 12:02 PM
sheeren ayesh
sheeren ayesh - avatar
3 Answers
0
Can you help me write the removal function?
21st Apr 2019, 3:24 PM
sheeren ayesh
sheeren ayesh - avatar
0
sheeren ayesh find the index of the element to be removed, set up a for loop starting from that index to the length-1 of the array. Shift the elements to the left. Decrease the num of elements -1. In case you are still lost with the removal function, there's a demostration of how it is supposed to work according to my description above. Not sure the syntax is very clear ( I'm rather new to C), but I hope it's understandable enough. You need to do some more work before using it though since you need to sort the array and search for the index first. https://code.sololearn.com/c3fXYdrW9l4Y/?ref=app
21st Apr 2019, 4:59 PM
{ 𝄋 ℒ 𝄋 }
{ 𝄋 ℒ 𝄋 } - avatar