「加速されたC++」を始めたばかりで、一部には次のコードスニペットがあります。
// ask for a person's name, and greet the person
#include <iostream>
#include <string>
int main()
{
// ask for the person's name
std::cout << "Please enter your first name: ";
// read the name
std::string name; // define name
std::cin >> name; // read into
// write a greeting
std::cout << "Hello, " << name << "!" << std::endl;
return 0;
}
エラーなしで問題なくコンパイルされますが、何も表示されません! 行からすべてを削除するとstd::string name;
、突然「名前を入力してください:」と表示されますが、もう一度追加しても表示されません...
(Eclipse で「CDT 内部ビルダー」を使用して「MinGW GCC ツールチェーン」を使用しています)