Lets say I have a loop that inputs a value from user, and if the value is equal to zero, it breaks.
Is there a way to do this without writing the same condition twice?
for example:
int x;
do
{
std::cin >> x;
if (x)
{
//code
}
} while(x);
What is the cleanest way to do this?