Question
#1. Section 6.2 contains a C program to read a sorted array of integers from an input file and display the array. The program then
#1. Section 6.2 contains a C program to read a sorted array of integers from an input file and display the array. The program then allowed the user to search for an element in the array and displayed its position if it was found, and deleted a user specified element from the array. Finally, the program displayed the modified array.
Extend this program to do the following:
Add a method (function) called insert() which should insert an element in the appropriate place in the sorted array.
Modify the main() method (function) to allow the user the following options: Search for a key, Delete an element, Insert an element, or Exit. The main() method should loop infinitely until the user decides selects Exit. Obviously, after the user inserts an element or deletes an element, the main() method should display the modified array.
Be sure to use appropriate indentation and variable names in your program.
The code to extend:
Sample Input/Output :
main() toexample1.c #includeStep 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