C++ Program to Insert an Element in an Array

Here is the C++ program to insert an element in an array. The array must be in ascending order.

For example the array is 1 4 6 7.

We have to insert 5.

Then the resultant array will be 1 4 5 6 7.

The program is given below.

C++ Program to Insert an Element in an Array

 

Output

Enter size of array:5
Enter the array in ascending order:
1 3 4 6 9

Enter element to insert:2
Array after inserting element:
1 2 3 4 6 9

3 thoughts on “C++ Program to Insert an Element in an Array

    1. Pintu Hossain

      input :1 3 4 5 6
      enter element to insert:7
      output 1 3 4 5 6 7 don’t show(why)

      Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.