Element Searching Easiest

#include<iostream.h>
#include<conio.h>
void main()
{
int n,h[25],s,i;
cout<<"Enter Number of Elements";
cin>>n;
for(i=0;i<n;i++)
{
cout<<"Enter Element"<<i+1<<":";
cin>>h[i];
}
cout<<"Enter Element To Search For:";
cin>>s;
for(i=0;i<n;i++)
{
if(s==h[i])
{
clrscr();
cout<<"Element Found";
break;
}
else
{
clrscr();
cout<<"Element Not Found!!!!!";
}
}
}
cout<<"Element Not Found!!!!!"; is in the wrong place - it should be outside the for-loop.
Topic archived. No new replies allowed.