My code is pasted below and the error picture is also attached. Please check it.
#include
#include
using namespace std;
template
int searching(T arr[],int n, T key)
{
for(int i=0;i<n;i++)
{
if(arr[i]==key)
{
return i;
}
}
return n;
}
template<class ForwardIterator, class T>
ForwardIterator search1(ForwardIterator start, ForwardIterator end1, T1 key)
{
while(start!=end1)
{
if(*start==key)
{
return start;
}
return end1;
}
}
int main()
{
int a[]={1,2,3,4,10,11};
int n=sizeof(a)/sizeof(int);
int key=10;
cout<<searching(a,n,key)<<endl;
float b[]={4.5,6.2,9.6};
float k=9.6;
cout<<searching(b,3,k)<<endl;
list<int> l;
l.push_back(1);
l.push_back(2);
l.push_back(4);
l.push_back(3);
auto it=search1(l.begin(),l.end(),4);
cout<<*it<<endl;
return 0;
}