#include #include //#include #define MAX 10 class lsearch { int a[MAX], n, i; public : void read(); int search(int i,int key, int found); }; void lsearch :: read() { cout << "\nEnter the Size of the Array : "; cin >> n; cout << "\nEnter the elements of the Array :\n"; for (i = 1; i <= n; i++) cin >> a[i]; } int lsearch::search(int i, int key, int found) { if (i > n) return (found); if (a[i] == key) { found++; cout << "\nThe Key element " << key << " is found at position : " << i; } search (++i, key, found); } int main() { int key, result, found=0; clock_t start, end; lsearch ls; ls.read(); cout<<"\nEnter the Element to be searched : "; cin>>key; start = clock(); // delay(2000); result = ls.search(1, key, found); end = clock(); if (!result) cout << "\nThe Key element " << key << " is not found"; cout<<"\n\nThe Time taken is : " << (end - start)/CLK_TCK; return 0; }