This gets the job done for what I need it to do, but I am wondering if there is an easier/more efficient way of accomplishing the same thing. The user inputs two numbers and they need to be between 0 and 50, if it doesnt fall within the required range it ends the prog
cout << "Enter the pixel coordinate (x, y): ";
cin >> usrInput1 >> userInput2;
if (usrInput1 > 50)
{
cout << "ERROR! 1" << endl;
return 0;
}
else if (usrInput1 < 0)
{
cout << "ERROR! 2" << endl;
return 0;
}
else if (usrInput2 > 50)
{
cout << "ERROR! 3" << endl;
return 0;
}
else if (usrInput2 < 0)
{
cout << "ERROR! 4" << endl;
return 0;
}
else
{
cout << "Success" << endl;
xvar = usrInput1 + usrInput2;
}
I was trying to do something like
if(! 0 > userInput1 || userInput2 > 99)
but obviously that didn't work out..
Thanks for any assistance
||like in sehe's answer.