If I have an int a;
and I want to set a value for this int (cin >> a;
) in a range 1 < a < 1000
, what is the most effective way how to type it via code? Is there a better way then if(a <=1 || a >= 1000)
? Since if I would have multiple of int
which I wanted to be limited by their value, I don't want to type a condition for every single one.
CodePudding user response:
Checking the condition a <=1 || a >= 1000
is exactly what you'd do