using switch with string

This simple program I made is to rise a student database with only using name as the input. I've tried using it with integer and char and they worked!. This is my first time using switch with string. I wonder if it possible but I got this error -> "switch quantity not an integer" or it's really impossible?

also, with the same whole codes and the string type before the enume changed by "typedef" (I don't know exactly what is this, just saw it on a template that I googled) I got a different errors, but seems pretty good compare to those above

One way would be to use an array of strings containing the acceptable values. Then do a sequential search through the array. If a match is found, you can use the index of the found item in order to control the action taken.

That may sound complex, but it's more expandable and easier to use with a large number of names than a long series of if-else statements.

And, as the cout message suggests, "There is no such name in database!", normally you wouldn't need to code the actual search as it would be handled by the database instead.

A nasty but workable solution would be taking Chervil's idea farther, and use an std::map with the std::strings as key, and a function pointer as data. When you find the name, you can call a function associated with it.

Something simpler, would be using std::map with name as key, and things you print as data.

that's okay giuscri I am also a noob and we are learning together. also I agree Catfish2' codes as the most suitable one with what I'm trying to. I just need time to understand the whole codes. until now, I can't even figure out the role of double colon (::) in c++