How to convert cPP strings to enumerations

how to convert a string to an enumerated type in cPP?

for example:

enum City{
    BEIJING,
    SHANGHAI,
    GUANGZHOU
}

//
City string_to_enmu(string str,City c);
CPP
May.22,2021
There is no good method for

. The enumeration of cPP is a simple type without name and other information. Use if else. If this enumeration is very large, you can consider doing a map, to speed up the execution efficiency first, but there are only three enumerations, the difference is not big.


is invited. The answer from i38me upstairs is all right.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3f47f-2bcca.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3f47f-2bcca.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?