Consider the following method: Method Body: void insertinArray(int num, int index){ int i; if(index >= counter){ NumAry[counter++] = num; return; } i = counter; while(i > index){ NumAry[i] =...


Consider the following method:


Method Body:


void insertinArray(int num, int index){
int i;
if(index >= counter){
NumAry[counter++] = num;
return;
}
i = counter;
while(i > index){
NumAry[i] = NumAry[--i];
}
NumAry[index] = num;
counter++;


}



The above method takes a number and position from user and then stores that number at specific position in an array, Now I want some additional  functionalities in this method that is if there is sorted array from 1 to 5 and user call this method and pass number=15 and index = 3, I want that the method prompts an error in this case asking the user that doing this the order of array will disturb, Would you like to continue? If the user continue it inserts the element at repective index and display a message that value inserted but order disturbed else it will terminate.


(Dont use pointers please)



Jun 01, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here