#include<iostream>
#include<conio.h>
using namespace std;
class sort{
private:
int d,c;
int a[20];
public:
void create();
void seq();
};
void sort::create()
{
for(int i=0;i<5;i++)
{
cout<<"Enter data at
["<<i<<"] : ";
cin>>a[i];
}
}
void sort::seq()
{
c=-1;
cout<<"Enter data to be find : ";
cin>>d;
for(int i=0;i<20;i++)
{
if (a[i]==d)
{
cout<<"Data found at index
["<<i<<"] ";
c=i;
break;
}
}
if(c==-1)
{
cout<<"Data not found";
}
}
int main()
{
sort s;
s.create();
s.seq();
}
OUTPUT:
0 comments:
Post a Comment