All I want to do for right now is sort command-line arguments, but I keep getting a segmentation fault (core dumped) error, which I think means I have a pointer pointing at an imaginary place.
#include<iostream>
#include<cstdlib>
#include<algorithm>
#include<vector>
using namespace std;
int main (int argc, char* argv[]) {
  vector<int> the_args;
  vector<int>::iterator it;
  it = the_args.begin(); //this seems logical to me.
  int i = 1; //so I'll skip over argv[0]
  while (i < argc) 
  {
    the_args.insert (it, atoi(argv[i]));
    i++;
    it++;//this is probably the perpetrator.
  }
  sort (the_args.begin(), the_args.end());
  for (it = the_args.begin(); it < the_args.end(); it++) //or else it's this
  {
    cout << *it << " ";
  }
  return 0;
}
I eventually want to program games. I've got enough experience in Java that I figured I could start trying to screw around in C++ and figure it out... but maybe not? Please be nice in your answers, I'm really discouraged that I even have to ask a question on here about sorting something.
 
     
     
    