I tried passing different inputs with the code below, but did not receive the message: "Unfortunately, you did not enter an ASCII char, not to mention that it is y or n!" I entered various Unicode characters that are not char type (mostly fair stamping in random ALT + numbers, for example ™, š, ², Ž, ±. None of these errors caused an error. Sin silently ignores or discards the input data are not ASCII characters?
std::cout << "Would you like to play again? Enter y or n: "; std::cin >> yOrN; isChar = std::cin.fail();
OS: Windows 10 64-bit, x64-based processor Compiler: Visual Studio 2015 community
I could not solve this problem by doing a search for “CIN C ++ character extraction without ASCII characters” and looking at the first three pages.
I'm very new to Stack Overflow, so forgive me if I break any rules or code of conduct with this question. I am learning C ++ at learncpp.com and writing my own code to answer question 2 of this page .
Update: I think there is no reason for my program to check if char is entered. However, I was probably so interested to know that I did not think too much about whether this was really necessary for the program.
source share