#include<iostream>
using namespace std;
bool Search(int arr[],int& s,int& val)
{
for(int i=0;i<s;i++)
{
if(val == a[i])
{
return true;
}
}
return false;
}
int main(void)
{
int size=0,value=0;
cout<<"\n\tEnter size of array:\t";
cin>>size;
int *arr=new int[size];
cout<<"\n\tEnter value to search in array:\t";
cin>>value;
if(Search(arr,size,value))
{
cout<<value<<" exist in array";
}
else
{
cout<<value<<" doesnot exist in array";
}
cout<<"\n\n";
return 0;
}
using namespace std;
bool Search(int arr[],int& s,int& val)
{
for(int i=0;i<s;i++)
{
if(val == a[i])
{
return true;
}
}
return false;
}
int main(void)
{
int size=0,value=0;
cout<<"\n\tEnter size of array:\t";
cin>>size;
int *arr=new int[size];
cout<<"\n\tEnter value to search in array:\t";
cin>>value;
if(Search(arr,size,value))
{
cout<<value<<" exist in array";
}
else
{
cout<<value<<" doesnot exist in array";
}
cout<<"\n\n";
return 0;
}
No comments:
Post a Comment