【发布时间】:2015-03-10 00:46:34
【问题描述】:
我正在用 C++ 制作一个文字冒险游戏。现在我得到这样的输入:
string word1, word2;
cin >> word1 >> word2;
parse(word1, word2);
一个示例输入可以是
goto store
现在,要退出,您必须输入 quit 和任何其他文本才能退出。
我怎样才能使输入由空格分隔,我可以判断第二个字符串是否为空。
更新
我尝试了第一个答案,我在 windows 上得到了这个错误:
The instruction at 0x00426968 referenced memory at 0x00000000.
The memory could not be read.
Click OK to terminate the program.
【问题讨论】:
-
一次读一行,然后把它分成多少个单词。