1.输入非该类型的字符
2.判断输入是否为\n;
while (cin >> str) { t.push_back(str); i++; if (cin.get() == '\n') //关键在这里,\n不能用双引号。。。 { break; } }