std :: cin :: и почему остается новая строка
СсылкаПочему консоль закрывается после того, как яВы включили cin.get ()?
Я использовалstd::cin.get()
#include
char decision = ' ';
bool wrong = true;
while (wrong) {
std::cout < "\n(I)nteractive or (B)atch Session?: ";
if(std::cin) {
decision = std::cin.get();
if(std::cin.eof())
throw CustomException("Error occurred while reading input\n");
} else {
throw CustomException("Error occurred while reading input\n");
}
decision = std::tolower(decision);
if (decision != 'i' && decision != 'b')
std::cout < "\nPlease enter an 'I' or 'B'\n";
else
wrong = false;
}
x; std::cin.get();
Мой вопрос почемуstd::cin
оставить новую строку\n
в потоке?