Using cin.get to get an integer
问题 I want to get a string of numbers one by one, so I'm using a while loop with cin.get() as the function that gets my digits one by one. But cin.get() gets the digits as char s and even though I'm trying to use casting I can't get my variables to contain the numrical value and not the ascii value of the numbers I get as an input. 回答1: cin.get can’t parse numbers. You could do it manually – but why bother re-implementing this function, since it already exists? * int number; std::cin >> number;