Consider the following method body which deletes a number from array: void deleteNum(int n) { int i, j, found = 0; //This method deleted a number from an array for (i = 0; i


Consider the following method body which deletes a number from array:


void deleteNum(int n) {


        int i, j, found = 0;                             //This method deleted a number from an array


        for (i = 0; i < counter;="" i++)="">


            if (NumAry[i] == n) {


                for (j = i; j < (counter="" -="" 1);="">


                    NumAry[j] = NumAry[j + 1];


                found = 1;


                i--;


                counter--;


            }


        }


        if (found == 0)


            cout < "\nelement="" doesn't="" found="" in="" the="">


        else {


            cout < "\nelement="" deleted="">


        }


    }



I want additional functionality in above method that when a number is deleted it should move that number to stack with the number itself and its position in array. Then the method shows menu to user if he wants to undo the deleted number and pop the number from stack and place it from where it is deleted from array.



Use arrays as stack and dont use pointers please.



Jun 06, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here