LINEARSE Search With Functions
LINEARSE Search With Functions
#include<iostream.h>
#include<conio.h>
#include<process.h>
void search(int[],int,int);
void main()
{
clrscr();
int x[10],i,s;
cout<<"Enter 10 no: \n";
for(i=0;i<10;i++)
{
cin>>x[i];
}
cout<<"Enter search elements : \n";
cin>>s;
search(x,s,i);
getch();
}
void search(int num[],int s,int z)
{
for(int i=0;i<z;i++)
{
if(s==num[i])
{
cout<<" Found at : "<<i+1;
getch();
exit(1);
}
}
cout<<"Not found";
}