title: How to declare string and whole number arrays in c++?
body: <pre><code>#include &lt;iostream&gt;
  using namespace std;
  
  int main()
  {
  // Declare variable  
      ifstream inFile;
  // Declare constant 
      const int MAX = 600;
  // Declare an array of strings named name that holds up to MAX 
      string array [name] = MAX;
  // Declare an array of whole numbers named grade that holds up to MAX
      double array [grade] = MAX;
  // Declare variables quantity, x, avg, and sum (initialized to zero) that hold whole numbers 
      int sum = 0, avg, x, quantity;
  // Open input file
      inFile.open("indata3.txt");
  // Check if the file was opened
      if (!inFile)
      {
      cout &lt;&lt; "File was not found!" &lt;&lt; endl;
      return 1;
      }
  // Set x to 0 
      x = 0;
  // Read name and grade from the file and assign them to name[x] and grade[x] respectively
      cin &gt;&gt; name[x];
      cin &gt;&gt; grade[x];
  // While (not-end-of-file) 
      while(inFile)
      {
  //Increment x 
      x++;
  //  Read a name and a grade from the file and assign them to name[x] and grade[x] respectively 
      cin &gt;&gt; name[x];
      cin &gt;&gt; grade[x];
      }
  // Print message 
      cout &lt;&lt; "Enter quantity of grades to be processed (0-" &lt;&lt; x &lt;&lt; "): " &lt;&lt; endl;
  // Read a value from the keyboard and assign it to quantity 
      cin &gt;&gt; quantity;
  // For (x = 0 to quantity-1)
      for (x = 0; x &lt;= quantity-1)
      {
  //16. Accumulate grade[x] in sum 
  
      }
  // Assign to avg the value returned by average (sum, quantity)
      avg = sum/quantity;
  // Print "Average grade: ", avg 
      cout &lt;&lt; "Average grade: " &lt;&lt; avg &lt;&lt; endl;
  // Print "Name", "Grade", "   Comment" 
      cout &lt;&lt; "Name" &lt;&lt; "," &lt;&lt; "Grade" &lt;&lt; "," &lt;&lt; "   Comment"  &lt;&lt; endl;
  // For (x = 0 to quantity-1) 
      for (x = 0; x &lt;= quantity-1)
  {
  // Print name[x], grade[x]
      cout &lt;&lt; name[x] &lt;&lt; ", " &lt;&lt; grade[x] &lt;&lt; endl;
  // If (grade[x] &lt; avg) 
      if (grade[x] &lt; avg)
      {
  //  Print "   below average"
      cout &lt;&lt; "   below average" &lt;&lt; endl;
      }
  // Else if (grade[x] &gt; avg) 
      else if (grade[x] &gt; avg)
      {
  //  Print "   above average"
      cout &lt;&lt; "   above average" &lt;&lt; endl;
      }
  // Else
      else()
      {
  //  Print "   average"
      cout &lt;&lt; "   average" &lt;&lt; endl;
      }
  }
  // Close the file.
      inFile.close();
  
  return 0;
  }
  </code></pre>
  
  <p>Here are some of the errors our of the 20. Most repeat the undeclared identifier. Also not sure where I would need to add more curly brackets to make it syntactically correct. One more thing..how do I accumulate grade[x] into sum? Any help would greatly be appreciated thank you.</p>
  
  <pre><code>error C2065: 'name' : undeclared identifier
  error C2075: 'array' : array initialization needs curly braces
  error C2065: 'grade' : undeclared identifier
  error C2371: 'array' : redefinition; different basic types
  error C2440: 'initializing' : cannot convert from 'const int' to 'double [1]'
  error C2228: left of '.open' must have class/struct/union1&gt;    type is 'int'
  error C2143: syntax error : missing ';' before ')'
  error C2059: syntax error : ')'
  error C2143: syntax error : missing ';' before '{'
  error C2228: left of '.close' must have class/struct/union1&gt;    type is 'int'
  </code></pre>