Embed presentation
Download to read offline
![PROGRAM 17
AIM: To create a menu driven program to insert & delete an element in a sorted array
SOLUTION:
#include<iostream.h>
#include<conio.h>
void initialize(int a[],int s);
void display(int a[],int s);
void insert(int a[],int &m);
void del(int a[],int &siz);
void main()
{
int ch,arr[70],size=0;
char p;
do
{
clrscr();
cout<<"||PROGRAM TO INSERT AND DELETE AN ELEMENT IN A SORTED 1D
ARRAY||";
cout<<"nn MENU:";
cout<<"n1.INITIALISE ARRAYn2.DISPLAY ARRAYn3.INSERT AN ELEMENT";
cout<<"n4.DELETE AN ELEMENT";
cout<<"nnEnter your choice ";
cin>>ch;
switch(ch)
{
case 1:
{
cout<<"Enter the size of array ";
cin>>size;
cout<<"nn##Initialise in ascending order##n";
initialize(arr,size);
}
break;
case 2:
display(arr,size);
break;
case 3:
insert(arr,size);
break;
case 4:
del(arr,size);
break;
}
cout<<"nTo go back to menu press y:](https://image.slidesharecdn.com/newmicrosoftworddocument-171229041332/85/New-microsoft-word-document-1-320.jpg)

This program creates a menu-driven program to insert and delete elements in a sorted integer array. The menu allows the user to initialize an array, display the array, insert a new element, or delete an existing element. Based on the user's selection, it calls the appropriate function to perform that operation and updates the array size.
![PROGRAM 17
AIM: To create a menu driven program to insert & delete an element in a sorted array
SOLUTION:
#include<iostream.h>
#include<conio.h>
void initialize(int a[],int s);
void display(int a[],int s);
void insert(int a[],int &m);
void del(int a[],int &siz);
void main()
{
int ch,arr[70],size=0;
char p;
do
{
clrscr();
cout<<"||PROGRAM TO INSERT AND DELETE AN ELEMENT IN A SORTED 1D
ARRAY||";
cout<<"nn MENU:";
cout<<"n1.INITIALISE ARRAYn2.DISPLAY ARRAYn3.INSERT AN ELEMENT";
cout<<"n4.DELETE AN ELEMENT";
cout<<"nnEnter your choice ";
cin>>ch;
switch(ch)
{
case 1:
{
cout<<"Enter the size of array ";
cin>>size;
cout<<"nn##Initialise in ascending order##n";
initialize(arr,size);
}
break;
case 2:
display(arr,size);
break;
case 3:
insert(arr,size);
break;
case 4:
del(arr,size);
break;
}
cout<<"nTo go back to menu press y:](https://image.slidesharecdn.com/newmicrosoftworddocument-171229041332/85/New-microsoft-word-document-1-320.jpg)
