#include "iostream.h"
#include "conio.h"
int main()
{
int *a,n,m,found = false,i;
cout << "How many Numbers? ";
cin >> n;
a = new int[n];
cout << "\nEnter " << n << " Numbers : ";
for(i = 0;i < n;i++)
cin >> a[i];
cout << "\n\nSearch : ";
cin >> m;
for(i = 0;i < n;i++)
if(a[i] == m)
{
found = true;
break;
}
if(found)
{
cout << "\n\nData Found: " << a[i];
cout << ", at Postion #" << (i + 1);
}
else
cout << "\n\nData Not Found";
getch();
return 0;
}
No comments:
Post a Comment