Upload
shivam-yadav
View
217
Download
1
Embed Size (px)
DESCRIPTION
PROGRAM IN C++ FOR INSERTION
Citation preview
#include<iostream.h>#include<conio.h>void fun(int a[],int &n,int num,int pos){for (int i=n;i>=pos-1;i--)a[i]=a[i-1];a[i+1]=num;n++;}void main(){ clrscr();int a[10],n,num,pos;cout<<"how many nos you want to enter\n ";cin>>n;cout<<"enter "<<n<<" numbers\n";for (int i=0;i<n;i++)cin>>a[i];cout<<"enter number to be inserted\n";cin>>num;cout<<"enter position of no ";cin>>pos;fun(a,n,num,pos);cout<<"new array is ";for (i=0;i<n;i++)cout<<a[i]<<"\n";getch();}/*outputhow many nos you want to enter 5enter 5 numbers13568enter number to be inserted7enter position of no 5new array is 135678*/