#include<iostream>
using namespace std;
template<class T>
T mini(T arr[],T size){
T max=arr[0];
for(int i=0;i<size;i++){
if (arr[i]<max)
{
max=arr[i];
}
}
return max;
}
int main(){
int arr[]={1,2,3,4,1,100,0};
int min=mini<int>(arr,7);//we can use size using size of arr and size of first element division
cout<<min;
return 0;
}
No comments:
Post a Comment