thats simple... all you have to do is enum all of the names.. then do a switch case with the numbers for printing so ill implement four names....
Code:
#include <iostream>
#include <string>
#include <math.h>
using namespace std;
enum studentNumber{
JohnDoe = 0, JohnSmith, JaneDoe, JoshShort
};
int main(){
int student = 0;
cout<< "Enter student number: ";
cin>> student;
switch(student)
{
case JohnDoe:
//inset what you want to diplay here
break;
case JohnSmith:
//inset what you want to diplay here
break;
case JaneDoe:
//inset what you want to diplay here
break;
case JoshShort:
//inset what you want to diplay here
break;
default:
cout<< "Error Something went wrong!";
break;
}
}
this isnt really the best way to go about making a syste of this type, and it really could be somewhat misleading if one of the students tries to make a program like this allowing you to create new students