Write a menu driven C++ program to Insert and Delete elements in a single dimension array of integers and print the array after insertion or deletion

For loop:

Thiru Malai
2 min readJun 3, 2021

for(initialization; condition; propagation)
{
statement(s)
}

do…while loop

This is another kind of loop. This is just like while and for loop but the only difference is that the code in its body is executed once before checking the conditions.

Syntax of do…while loop is:

do{
statement(s)
}
while( condition );

Switch..case

Normally, if we have to choose one case among many choices, nested if-else is used. But if the number of choices is large, switch..case is a better option as it makes our code more neat and easier.

Let’s have a look at its syntax.

switch(expression)
{
case constant1:
statement(s);
break;
case constant2:
statement(s);
break;
/* you can give any number of cases */
default:
statement(s);
}

Code:

Void functions are stand-alone statements

In programming, when void is used as a function return type, it indicates that the function does not return a value. … When used in a function’s parameter list, void indicates that the function takes no parameters.

display()- display function displays the number of element in array.

insert()-insert function inserts an element to the array.

delete()-delete function deletes an element in the array.

--

--