I'm building a text-based game in C++ as a side project in my learning, and so I'm trying to find a way for string to be evaluated in two halves. It will check the first word, then if the word is recognized, it will see what the word after it is. For example if the input in a getln(); is "take apple" it will recognize the "take", then check to see what exactly you are taking in the second half of the string. Right now the only way I can think of doing it is by the player entering "take" and this leading into a ton of nested if/else statements.
Aucun commentaire:
Enregistrer un commentaire