C++ How to use less conditional statements?
问题 For my assignment, I'm storing user login infos. I'm taking in a string which is the command. The command can be create, login, remove, etc. There are 10 total options, i.e 10 different strings possible. Can anyone explain a more efficient way to write this instead of 10 if and else if statements? Basically how should I format/structure things besides using a bunch of if (string == "one") , else if (string == "two") . Thank you 回答1: I expect that your lecturer would like you to extract