#include<iostream.h>
#include<conio.h>
int a[10];
void begin (int x)
{
a[0]=x;
}
void end(int y)
{
a[9]=y;
}
void pos(int z)
{
int n;
cout<<"Enter the desired position: ";
cin >> n;
a[n-1]=z;
}
void main()
{
clrscr();
int ch,i;
do
{
cout<<"1.Insert an element at the begining."<<endl;
cout<<"2.Insert an element at the end."<<endl;
cout<<"3.Insert an element at the desired position."<<endl;
cout<<"4.Display array elements."<<endl;
cout<<"5.Exit."<<endl;
cout<<"Enter your choice: ";
cin>>ch;
switch(ch)
{
case 1: {
cout<<"\nEnter value of element: ";
cin>>i;
begin(i);
break;
}
case 2: {
cout<<"\nEnter value of element: ";
cin>>i;
end(i);
break;
}
case 3: {
cout<<"\nEnter value of element: ";
cin>>i;
pos(i);
break;
}
case 4: {
clrscr();
for(i=0;i<=9;i++)
{
cout<<"Element at "<<i+1<<" position: "<<a[i]<<endl;
}
}
case 5: {
break;
}
default: {
cout<<"\nWrong choice entered.\n";
}
}
cout<<endl;
}
while(ch!=5);
}