Question: C++ Code Write a program DeletingAnArrayElement. Declare an array of type int. int [] myArray ={45, 38, 27, 46, 81, 72,56, 61, 20, 48, 76,
C++ Code
Write a program DeletingAnArrayElement.
Declare an array of type int.
int [] myArray ={45, 38, 27, 46, 81, 72,56, 61, 20, 48, 76, 91, 57, 35,78};
Print the array to the console and ask the user which number s/he wants to delete?
Once the user enters the number, must check the number in the array and display the index number where it was found.
If the number is not found, you must ask again and again until user enters the number that is in the array.
when you find the number, delete it (Hint: move the right side of the numbers to the left).
Don't need to loop after deleting the number.
Your program must show the new array with the reduced length.
Expected Output : (Text in Bold, entered by user)
Here is the array!
45 38 27 46 81 72 56 61 20 48 76 91 57 35 78
Which number you want to delete? : 4
This number is not in the array!
Array is: 45 38 27 46 81 72 56 61 20 48 76 91 57 35 78
Which number you want to delete? : 7
This number is not in the array!
Array is: 45 38 27 46 81 72 56 61 20 48 76 91 57 35 78
Which number you want to delete? : 81
Number found at index : 4
Now the new array is: 45 27 46 72 56 61 20 48 76 91 57 35 78
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
