im just wondering how do we display 3 minimum values for in a single array
That really depends on the size of the array. With a small array (less than 10 to 100 elements) iterating through the loop might be adequate but with a large array I would consider sorting, then just printing the first/last three elements.
For variety, boost has a library that can do this, and tons more statistics on a sequence of numbers, all in a single pass (although for this specific use case, it's more complicated than a trivial single-pass solution)
1 2 3 4 5
accumulator_set<int, features<tag::tail<left>>> acc(tag::tail<left>::cache_size = 3);
acc = std::for_each(std::begin(a), std::end(a), acc);
std::cout << "The 3 smallest values are ";
for(int n : tail(acc))
std::cout << n << ' ';
Note that this algorithm prints repetitions, so the output for above will be: 0, 0, 1 as 0 is repeated twice. The algorithm in geeksforgeeks does not count repetitions.