Question’s all in the title.
I’m making a calculator and I obviously need input. I use the cin>> function but I was wondering if there is a way to test the input to find out if it’s a number.
If I enter anything that isn’t a number the program crashes. Is there a built in function/operator? Please help!
Question’s all in the title. I’m making a calculator and I obviously need input.
Share
The input operator will only read to an integer if the input is a number. Otherwise it will leave the characters in the input buffer.
Try something like this