Code For Program To Perform Array Operations Like Append, Insert, Delete, Edit, Display and Search and Element in C++ Programming
Code For Program To Perform Array Operations Like Append, Insert, Delete, Edit, Display and Search and Element in C++ Programming
: ";
search : ";
cin>>key;
for(pos=0;pos<no_el;pos++)
{
if(array[pos]==key)
break;
}
if(pos==no_el)
{
cout<<"Search key not found";
break;
}
for(i=pos;i<no_el;i++)
array[i]=array[i+1];
no_el--;
break;
case 4:
cout<<"Enter the position to be edit : ";
cin>>pos;
cout<<"Enter the new value for old position : ";
cin>>array[pos-1];
break;
case 5:
cout<<endl;
for(i=0;i<no_el;i++)
cout<<endl<<"The element is : "<<array[i];
break;
case 6:
cout<<"Enter the value to be search : ";
cin>>key;
for(pos=0;pos<no_el;pos++)
{
if(array[pos]==key)
break;
}
if(pos==no_el)
{
cout<<"Search key not found";
break;
}
cout<<"Search key found at : "<<pos+1;
break;
case 7:
return(0);
break;
}
getch();
}