title: Partially Fill an array from a file
body: <p>I need to partially fill 2 arrays with data from a file and keep them parallel. But my current code gives me errors that look like giberish. If someone could even just help me decode the errors i would be very grateful. </p>
  
  <p>Code:</p>
  
  <pre><code>/***************************************************/
  /* Author:     Sam LaManna                         */
  /* Course:     CSC 135 Lisa Frye                   */
  /* Assignment: Program 6 Elves                     */
  /* Due Date:   11/22/11                            */
  /* Filename:   program6.cpp                        */
  /* Purpose:    Write a program that will process   */
  /*             the work done by santas elfs        */
  /***************************************************/
  
  #include &lt;iostream&gt;     //Basic input/output
  #include &lt;iomanip&gt;      //Manipulators
  #include &lt;string&gt;       //String stuff 
  #include &lt;fstream&gt;      //File input/output
  
  using namespace std;
  
  void instruct ();     //Function Declaration for printing instructions 
  void input (ifstream &amp;infile, string names [50], int numoftoys[50]);    //Function declaration for getting data from file
  
  int main()
  {
  
    string names [50] = { };       //Array for storing names
    int numoftoys [50] = { };      //Array for storing the number of toys made
  
    ifstream infile("eleves.dat"); //Opens input file "elves.dat"
  
    instruct();     //Function call to print instructions
  
    while (!infile.eof())
      {
        input (names [50], numoftoys [50]);
      }
  
    cout &lt;&lt; names &lt;&lt; "\n" &lt;&lt; "\n";
  
    cout &lt;&lt; numoftoys &lt;&lt; "\n" &lt;&lt; "\n";
  
  
  
  
    return 0;
  }
  
  
  
  
  /***************************************************/
  /* Name: instruct                                  */
  /* Description: Prints instructions to user        */
  /* Parameters: N/A                                 */
  /* Return Value: N/A                               */
  /***************************************************/
  
  void instruct ()                                   
  {
    cout &lt;&lt; "\n" &lt;&lt; "This program will calculate the toys made by santas elfs and assign" &lt;&lt; "\n";
    cout &lt;&lt; "a rating to each elf. It will also sort them and print average, min and max." &lt;&lt; "\n";
    cout &lt;&lt; "\n" &lt;&lt; "Make sure you have a file named elves.dat in the same directory as";
    cout &lt;&lt; "this porgram or you will recieve errors.";
    cout &lt;&lt; "\n" &lt;&lt; "\n";
  
    return;
  }
  
  
  /***************************************************/
  /* Name: input                                     */
  /* Description: Reads from file                    */
  /* Parameters: N/A                                 */
  /* Return Value: N/A                               */
  /***************************************************/
  
  void input (ifstream &amp;infile, string names [50], int numoftoys[50])
  {
    infile &gt;&gt; names &gt;&gt; numoftoy;
    infile.ignore ("\n");
  
    return;
  }
  </code></pre>
  
  <p>Errors:
  <a href="https://imgur.com/q7I4g" rel="nofollow noreferrer"><img src="https://i.imgur.com/q7I4g.png" alt="" title="Hosted by imgur.com" /></a></p>
  
  <p>Direct Link: <a href="https://i.imgur.com/q7I4g.png" rel="nofollow noreferrer">http://i.imgur.com/q7I4g.png</a></p>