Project : Match Up.

I have a proeject that I am working on. The goal is to organize a predetermined list of students into groups randomly. The groups are predetermined by grades.
Group 1 would be +100-90% Group 2 would be 89-80% Group 3 would be 79-70% and Group 4 would be 69% and below. The list needs to be able to be edited by adding or removing names. When the students are in groups they need to be paired up. The students can't be paired more then once and groups of three are allowed and if you have a remainder in one group you can pair the remainder with one group below. An example would be.
Group 1 ( In group 1 2 pairs would need to be created)
TAYLOR 98
NOAH 97
KYLE 96
GREYSON 95

Group 2 ( In group 2 3 pairs would need to be created)
ANDREW 88
DAVID 87
JEREMY 85
SEAN 83
KEVIN 82
MATHEW 80

Group 3 ( In group 3 1 group of 3 would need to be created. There is a remainder of students so they would need to pair with a group below them)

NATHAN 79
BRITTANY 75
BRADLEY 73
JOHN 72

Group 4 (In group 4 6 pairs would be created includeing the member that was a remainder from group 3)
GEOFFREY 69
DOUG 68
JOY 67
ETHAN 65
CLAYTON 64
CARLESHA 63
ZACHARY 62
JAMES 61
BRANDON 60
STORM 60
MICHAEL 60
I need to know what kind of structures would allow me to do this. The problems I am having are accesing a predetermined list and useing the values in the list for the rest of the program. I'm trying to use the Input/Output with files tutorial to help me with the list. I also imagine myself having trouble with being able to add and remove from the file with in the program.
vector of vectors. or map or vectors would be good if you didn't wanna build an OO structure.
...I would suggest a vector of vectors, encapsulated in a class (say, GroupList) that provided the necessary interface to the lists, i.e. add a student, remove a student and pair students. Catch my drift?
My suggestion:

Students:
define a structure student containing "string name", "int grade" (if needed) and a pointer to the next student within the group (the last student has a null-pointer here) "struct student *next"

Groups:
Array with four pointers to the first student of each group.

I think all tasks can be solved with this construction: Adding students, removing students, pairing students. You can also sort the list by name or by grade or search for a name in the list...

A class to provide an interface to the list is a great idea, but not necessary unless you don't want to handle various lists in one program (e.g. one list for each class). But if you're using a class it would be easy to expand your program to this task.
Topic archived. No new replies allowed.