As far as C++ goes, I would think a std::map would work here (assignment requirements aside). A map stores (key, value) pairs. You can look up a value based on its key. In this case, student names or perhaps a student data type would be the value, and the student number would be the key.
Java programming language enum types are much more powerful than their counterparts in other languages. The enum declaration defines a class (called an enum type). The enum class body can include methods and other fields.