Ask a Teacher



Write a program to initialize an array 0f 10 integers.take an integer as input from the user,search it in the array and delete it.make required shifting.

include <iostream>


int main()

{
int x[10],a;
int search=0;

for(int i=0;i<10;i++)
{
cout<<"Enter the No:"<<endl;
cout>>x[i];
}
cout<<"Search No"<<endl;
cout>>a;
for(int i=0;i<10;i++)
{
if(x[i]==a)
{
x[i]=x[i+1];
search=1;
}
}
if(search==0)
{
cout<<"Searching No is Not:"<<endl;
}
}


comments powered by Disqus