#include #include using namespace std; int minimum(int *first, int *last); int main() { int a[] { 1968, 2001, 1492, 1945, 1066, 1918 }; cout << "The smallest number is " << minimum(begin(a), end(a)) << ".\n"; return EXIT_SUCCESS; } int minimum(int *first, int *last) { if (first == last) { cerr << "The array is empty, so it has no smallest element.\n"; exit(EXIT_FAILURE); } int smallest {*first}; //Temporarily assume that first el is smallest. for (++first; first != last; ++first) { if (*first < smallest) { smallest = *first; } } return smallest; }