Completely lost with grading program - any help?

Hello!

So I'm currently working on a grading program and I am to write a function that grades ANexam and returns the score when passed the key and and one set of answers. The answers to the exam cannot be stored and I am to only use an array to output how many earned each score (out of a possible 11).
This other function will take that array and # of questions as parameters and find the high, low, and mean.

However, I am completely unsure after hours of digging on just how to compare each element of the answer key to each element of the students answers.
The .txt I'd pull from would be structured as follows:
1
2
3
4
5
6
bccbbadbca <- Answer Key
badbcabccb
bccbccbbad
bccbbadbca
bcbccbbaaa


And here is the code I'm using:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#include <iostream>
#include <fstream>
#include <string>

using namespace std;

const int MAX_STUDENTS = 250;
const string sGrades = "grade_data.txt";

bool getData(string gFile, string grades[],int &numGrades);
int scoreAnswers(string grades[], int numGrades); // Used later


int main ()
{
    string grades[MAX_STUDENTS];
    int numGrades = 0;
    
    getData(sGrades, grades, numGrades);
cout << "Total Grades Read in: " << numGrades <<endl;

    for (int i = 0; i < numGrades; i++)
     cout << i << " " << grades[i]<< endl;
     
cout << "# of Correct answers " << grades[scoreAnswers(grades, numGrades)]
<< endl;

      system("pause");
      return 0;
}
int scoreAnswers(string grades[], int numGrades)
{
    string ansKey (grades[0]);
    int score = 0;
    
    for (int i=1; i < numGrades; i++)
    score +=(ansKey == grades[i]);
    //if (ansKey.compare(grades[i]) == 0)
    //cout << ansKey << " this is right " << i << " = 0 " << endl;
cout << "Total Correct " << score << endl;
    
  //  if (ansKey.come(grades[i]) 
    
    return score;
    
}
    

bool getData(string gFile, string grades[], int &numGrades)
{
   ifstream inFile;
   inFile.open(sGrades.c_str());
         
   if (!inFile)  //Used later in an unwritted function
     return false;

   string answers;
         
   inFile >> answers; // 1st value read in @0
   while (!inFile.eof()) // Reads values after 0
   {
      grades[numGrades] = answers;
      numGrades++;
   
   inFile >> answers;
   }


         return true;
    }
    


When ran, I am given a number that reflects how many strings equally match the answer key. How would I proceed to compare each element of the answer key to each element of the students answers and return the number of elements matching that of the answer key?

Thanks for your time!
Not sure if this will help, but I think it will...

http://www.youtube.com/watch?feature=player_detailpage&v=fhe0IVJOy4g#t=1298
Definitely a step in the right direction, thanks a lot.
Topic archived. No new replies allowed.