Check the return value from scanf()
. It will return the number of successfully scanned inputs - in your case it should be 1
. If it is not equal to one, it could be -1 which means "end of file" or 0, which means "input wasn't valid".
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…