-3
enter code here
int main()
{
std::string input;
std::cin >> input;
while (input != "quit")
{
// do stuff
std::cin >> input; // get another input
}
return EXIT_SUCCESS; // if we get here the input was quit
問題是,它不會提示用戶輸入文字。如果我輸入「退出」,它結束,所以這工作正常。否則,如果我輸入其他任何內容,則輸入quit,它也會退出。我應該怎麼做才能糾正這個問題?需要一個句子並輸出元音,輔音等元素的程序
通過我的研究,我在這裏找到了一個類似的程序,它使用大小寫,但對我來說似乎有點乏味。我被指示使用isalpha函數,該函數接受單個字符作爲參數,並返回布爾指示符,以確定該字符是否是字母。
請讓你的標題與您無關,實際上是試圖問題問(不管可能如何)。 – juanchopanza
需要在某處使用'std :: cout' - 我猜 –
而不是'cin'嘗試使用'getline(..)'。 – Poriferous