I see the obvious traits of a homework question.
You create a class called student, with name and stuff like that. Also, a static variable to define the next new ID could be in that class. Take one for the new student in the constructor, and +1 the staic var. In this class you can use dynamic construction/destruction, see tutorials on Classes II on this site for that.
The menu could simply be requestion a number, all this in a while(menuDecision != 3). You should declare that variable prior to the loop.
1 2 3 4 5 6 7 8 9 10 11 12
|
Student students[200]; // Or a virtually unfeasable number, not too high though
char menuDecision = 0;
while(menuDecision != '3')
{
cout << "1: Add student" << endl;
cout << "2: List all students" << endl;
cout << "3: Exit" << endl;
cout << ">";
cin >> menuDecision;
// switch/case or if/else if to understand the input.
}
|
Then keep a int to increment by one for each student added and list that number of students from the array. And add it to students[n - 1] where n is that variable.
I hope I helped you, while still being within the limits of what I can do without getting my post deleted.
You know, part of being a programmer is to think logical, you should have thought up a sollution or part of it asap as you read your assignement. You might get vaguer assignements from a potential employer I think.