Reading numbers from three text files in C++
I'm going to be cheeky here and make a recommendation that's currently beyond what I suspect your current C++ level is, because I feel like this is a great problem to introduce templates:

Consider splitting the file reading in its own function, so that you don't have to reimplement the file loading logic three times. In this case, this will necessarily be a function template, since you can load different type of values.

Here's what it would look like:

template&lt;typename T&gt;
std::vector&lt;T&gt; read_num_file(const char* file_name) {
  // open ifstream and error check here...

  std::vector&lt;T&gt; result;
  T val;
  while(InFile &gt;&gt; val) {
    result.push_back(val);
  }
  return result;
}

int main() {
  std::vector&lt;unsigned short&gt; index = read_num_file&lt;unsigned short&gt;("Index.txt");

  ...
}