There are N values in the array, and one of them is the smallest value. How can I find the smallest value most efficiently?
We can use min_element(array, array+size) function . But it iterator
that return the address of minimum element . If we use *min_element(array, array+size) then it will return the minimum value of array.
#include
using namespace std;
int main()
{
int num;
cin>>num;
int arr[10];
for(int i=0; i>arr[i];
}
cout<<*min_element(arr,arr+num)<