What I'm wondering is pretty simple, but I have no idea how to do it the right way or how many ways there are to do it.

Say I want a user to input a number, but if the user inputs something else than a number it breaks my program. How do I succeed in checking that the input is correct with CIN?

I've tried using typedef/id/name but I guess it's used for Templates, so I'm out of luck.

Is there any inbuilt class that does this, or how do I make it myself?

Any help is appreciated.

Thanks!