I'm trying to work through a program and I got it to work, but I'm wondering if there is a cleaner way to write what I'm trying to do. I need to get 2 numbers, run them through an equation and display the answer. The program needs to do this until one of the numbers are 0. Here is what my while loop looks like:
1 2 3 4 5 6
while ((cin >> x >> y) && ((x != 0) && (y != 0)))
cout << hm(x, y);
cout << " is the answer.\n";
cout << "Enter the next two numbers (q to quit): ";
This worked exactly like I wanted it to, but I was wondering if there is a cleaner way to write this condition? I just don't want to get into bad habits before I move onto more difficult stuff. I would appreciate any feedback.