Array Programs

C++ program to Insert an element Into sorted array

Insert an Element

Array is a collection of similar type of elements.We can perform operation on this.This program shows how to insert an element into sorted array.

  • In this program we first have taken the size of array.
  • After taking the size of array user will enter the elements into array.
  • After entering the element the program will sort the array in ascending order.
  • Once the sorting will be done user will enter the location where he/she wants to insert the element.
  • At last after entering the location program will ask you to enter a element you want to insert.
  • At the end you will get a output of new array.

OUTPUT:-

Before Insert

insert An element

After Insert

insert an element