Language: C++

/**
 * ???????????????
?????????????????????????¨??????????????????§?????????????°????????????????????????????????????´???????????¢?????´???????????§??????

1 selectionSort(A, N) // N??????????´??????????0-?????????????????????A
2   for i ??? 0 ?????? N-1 ?????§
3     minj = i
4     for j ??? i ?????? N-1 ?????§
5       if A[j] < A[minj]
6         minj = j
7     A[i] ??¨ A[minj] ?????????
??°???A??????????????????????????????????????¢?????´???????????§?????????????????????????????????????????°????????????????????????????????????????????????????????????????????¢?????´????????????????£??????????????????????

??????????????? 7 ????????§???i ??¨ minj
?????°?????????????????????????????????????????°??????????????????????????????

??\???
??\??????????????????????????°?????????????????¨?????´??° N ???????????????????????????????????????N
????????´??°????????????????????§?????????????????????

??????
????????? 2 ??????????????????????????????????????´??????????????°?????? 1
???????????????????????????????????°????????£?¶???????????´?????????????????????§????????£??????????????????????????????2
????????????????????°??????????????????????????????

??¶?´?
1 ??? N ??? 100
0 ??? A ???????´? ??? 100
??\?????? 1
6
5 6 4 2 1 3
????????? 1
1 2 3 4 5 6
4

??\?????? 2
6
5 2 4 6 1 3
????????? 2
1 2 3 4 5 6
3
 */

#include <algorithm>
#include <iostream>
#include <sstream>
#include <utility>
#include <vector>

unsigned short selectionSort(std::vector<unsigned short> &Numbers) {
  const size_t n = Numbers.size();
  unsigned short minj;
  unsigned short SwapCount = 0;
  for (size_t i = 0; i < n; i++) {
    minj = i;
    for (size_t j = i; j < n; j++) {
      if (Numbers[j] < Numbers[minj]) {
        minj = j;
      }
    }
    if (i != minj) {
      SwapCount++;
    }
    std::swap(Numbers[i], Numbers[minj]);
  }
  return SwapCount;
}

void printVector(const std::vector<unsigned short> &v) {
  std::ostringstream oss;
  std::copy(v.begin(), v.end() - 1,
            std::ostream_iterator<unsigned short>(oss, " "));
  oss << v.back();
  std::cout << oss.str() << std::endl;
}

int main(int argc, char const *argv[]) {
  unsigned int N;
  std::istringstream iss;
  std::string Param;

  while (true) {
    getline(std::cin, Param);
    iss.str(Param);
    iss >> N;
    iss.clear();
    if (N < 1 || N > 100) {
      std::cout << "Error: 1 <= N <= 100" << std::endl;
    } else {
      break;
    }
  }

  size_t i = 0;
  std::vector<unsigned short> A(N, 0);

  while (true) {
    bool isValid = false;
    unsigned short An;
    getline(std::cin, Param);
    iss.str(Param);
    while (i < N) {
      iss >> An;
      if (An > 100) {
        std::cout << "Error: 0 <= A <= 100" << std::endl;
        isValid = false;
        break;
      } else {
        A[i] = An;
        isValid = true;
        i++;
      }
    }
    iss.clear();
    if (isValid == true) {
      break;
    }
  }
  unsigned short SwapCount = selectionSort(A);
  printVector(A);
  std::cout << SwapCount << std::endl;

  return 0;
}

Compiler output:
a.cc: In function 'void printVector(const std::vector<short unsigned int>&)':
a.cc:72:18: error: 'ostream_iterator' is not a member of 'std'
   72 |             std::ostream_iterator<unsigned short>(oss, " "));
      |                  ^~~~~~~~~~~~~~~~
a.cc:49:1: note: 'std::ostream_iterator' is defined in header '<iterator>'; this is probably fixable by adding '#include <iterator>'
   48 | #include <vector>
  +++ |+#include <iterator>
   49 | 
a.cc:72:35: error: expected primary-expression before 'unsigned'
   72 |             std::ostream_iterator<unsigned short>(oss, " "));
      |                                   ^~~~~~~~