Question: Question 1: Given the following sorted array with unique elements: 2 5 7 11 18 30 Write a C++ program that allows the user to

Question 1: Given the following sorted array with unique elements: 2 5 7 11 18 30 Write a C++ program that allows the user to update this array's elements by reading the index of the element to updated and the new value, while keeping the array sorted and contains only unique values. The program should continue asking the user to update the array's elements until the user enters zero. Sample Run: Array elements: 2 5 7 11 18 30 **** Update the array's elements: Enter an index: 2 Enter the new value: 18 Sorry you can't update .. This value already exists! Enter o to stop, any value to continue: 1 Enter an index: 4 Enter the new value: 0 Array after update: O 2 5 7 11 30 Enter o to stop, any value to continue: 1 Enter an index: 1 Enter the new value: 50 Array after update: 5 7 11 30 50 Enter to stop, any value to continue: 0
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
