lundi 9 mars 2015

Seperating input C++

I am making a text adventure game in C++. Right now I am getting the input like this:



string word1, word2;
cin >> word1 >> word2;
parse(word1, word2);


An example input could be



goto store


Right now, to quit you would have to type quit and any other text to quit.


How can I make it so the input is separated by a space and I can tell if the second string is empty.


Aucun commentaire:

Enregistrer un commentaire