title: Segmentation Fault (Core Dumped) issue windows to linux
body: <p>I have been using Visual Studio on Windows to program and my code works fine, but when running it on Ubuntu I get a</p>
  <blockquote>
  <p>Segmentation fault (core dumped)</p>
  </blockquote>
  <p>issue and I don't know what is causing it. I have no idea where in the code the issue would be, so I pasted all of it.</p>
  <pre><code>#include &quot;Person.h&quot;
  #include &quot;Grade.h&quot;
  
  using std::ifstream;
  using std::ofstream;
  using std::cout;
  using std::cin;
  using std::endl;
  using std::vector;
  using std::stringstream;
  using std::fixed;
  using std::setprecision;
  using std::setfill;
  
  unsigned z = 0;
  unsigned y = 0;
  
  void firstInput(vector&lt;Person&gt;&amp; peoples, char *argv[])
  {
  int x = 0;
  string idy, namey, addressy, phoney, s;
  
  ifstream one;
  one.open(argv[1]);
  
  while (getline(one, s))
  {
      if (x == 0)
      {
          idy = s;
      }
  
      if (x == 1)
      {
          namey = s;
      }
  
      if (x == 2)
      {
          addressy = s;
      }
  
      if (x == 3)
      {
          phoney = s;
          Person *f1 = new Person(idy, namey, addressy, phoney);
          peoples.push_back(*f1);
          x = -1;
      }
  
      x++;
  
  }
  
  one.close();
  }
  
  void secondInput(vector&lt;Grade&gt;&amp; gradies, char *argv[])
  {
  int b;
  string z, idy2, gradey, classy;
  
  ifstream two;
  two.open(argv[2]);
  
  b = 0;
  
  while (getline(two, z))
  {
      if (b == 0)
      {
          classy = z;
      }
  
      if (b == 1)
      {
          idy2 = z;
      }
  
      if (b == 2)
      {
          gradey = z;
          Grade *g1 = new Grade(classy, idy2, gradey);
          gradies.push_back(*g1);
          b = -1;
      }
      b++;
  }
  
  two.close();
  }
  
  double scoreConverter(string lettergrade)
  {
  double converted = 0.0;
  
  if (lettergrade.substr(0,1) == &quot;A&quot;)
  {
      converted += 4;
  }
  
  if (lettergrade.substr(0,1) == &quot;B&quot;)
  {
      converted  += 3;
  }
  
  if (lettergrade.substr(0,1) == &quot;C&quot;)
  {
      converted += 2;
  }
  
  if (lettergrade.substr(0,1) == &quot;D&quot;)
  {
      converted += 1;;
  }
  
  if (lettergrade.size() &gt; 1)
  {
      if (lettergrade.substr(1,2) == &quot;-&quot;)
      {
          converted -= 0.3;
      }
      if (lettergrade.substr(1,2) == &quot;+&quot;)
      {
          converted += 0.4;
      }
  }
  return converted;
  }
  
  void computeGPA(vector&lt;Grade&gt;&amp; s, vector&lt;Person&gt;&amp; p, string IDnum)
  {
  int count = 0;
  y = 0;
  double gpa = 0;
  
      for (string x = IDnum; y &lt; s.size(); y++)
      {
          if (x == s.at(y).getIDs())
          {
          gpa += scoreConverter(s.at(y).getScore());
          count++;
          }
      }   
          if (gpa &gt; 0)
          {
          gpa = gpa / count;
          }
          cout &lt;&lt; IDnum &lt;&lt; &quot;    &quot;;
          cout &lt;&lt; fixed &lt;&lt; setprecision(2) &lt;&lt; setfill('0') &lt;&lt; gpa &lt;&lt; &quot;    &quot;;
  
      for (unsigned x = 0; x &lt; p.size(); x++)
      {
          if (IDnum == p.at(x).getID())
          {
              cout &lt;&lt; p.at(x).getName() &lt;&lt; endl;
              x = 1000;
          }
      }
  
      z = y;
  }
  
  void thirdInput(vector&lt;Grade&gt;&amp; gradies, vector&lt;Person&gt;&amp; persons, char *argv[])
  {
  string querying;
  
  ifstream three;
  three.open(argv[3]);
  
  
  while(getline(three, querying))
  {
  for (unsigned x = 0; x &lt; persons.size(); x++)
  {
      if (querying == persons.at(x).getID())
      {
          computeGPA(gradies, persons, persons.at(x).getID());
          x = 1000;
      }
  }
  }
  }
  
  int main(int argc, char *argv[]) {
  
  ofstream outputit;
  outputit.open(argv[4]);
  
  std::ofstream out(argv[4]);
  std::cout.rdbuf(out.rdbuf());
  
  vector&lt;Person&gt; people;
  vector&lt;Grade&gt; grades;
  
  firstInput(people, argv);
  
  std::sort(people.begin(), people.end());
  
      for (unsigned x = 0; x &lt; people.size(); x++)
      {
          cout &lt;&lt; people.at(x).getName() &lt;&lt; endl;
          cout &lt;&lt; people.at(x).getID() &lt;&lt; endl;
          cout &lt;&lt; people.at(x).getPhone() &lt;&lt; endl;
          cout &lt;&lt; people.at(x).getAddress() &lt;&lt; endl;
      }
  
      cout &lt;&lt; endl;
  
  secondInput(grades, argv);
  
  std::sort(grades.begin(), grades.end());
  
  for (unsigned x = 0; x &lt; grades.size(); x++)
  {
      cout &lt;&lt; grades.at(x).getIDs() &lt;&lt; &quot;    &quot;;
      cout &lt;&lt; grades.at(x).getScore() &lt;&lt; &quot;    &quot;;
      cout &lt;&lt; grades.at(x).getClass() &lt;&lt; endl;
  }
  
  cout &lt;&lt; endl;
  
  thirdInput(grades, people, argv);
  
  outputit.close();
  }
  </code></pre>