How can I relate arrays?

For example I have 3 arrays:

string studentID[] = {"P1001", "P1002"};
float studentMark[] = {78.50, 66};
char studentGrade[] = {D, C};

The records for the student records are as follow:

Student ID: P1001
Mark: 78.50
Grade: D

Student ID: P1002
Mark: 66
Grade: C

How can I make it so that these arrays relate to each other?
Because I want to display the marks and grades of a student when their corresponding student ID's are entered.
Put them in a class or struct.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
struct StudentInfo
{
  string id;
  float mark;
  char grade;
};

//--------------------------------

StudentInfo students[2] =
{
   {"P1001",78.50,'D'},
   {"P1002",66,'C'}
};


Isn't this kind of same thing as your other thread though? =P I guess it's a different question
Topic archived. No new replies allowed.