9
I need to make an algorithm that gets 3 different numbers, and if it gets repeated numbers, it gives an error message.
My program is all working properly, but when I put such a line to warn of the error I try to use Or
and it doesn’t work. Here’s what I’m typing
if (z==x) or (y==z) or (x==y);
cout << "\nErro. Os valores devem ser diferentes. Tente novamente: \n" << endl;
Even if there’s an easier way than or
, you could kindly tell me how the insertion of the or
in C++ ?
According to Code::Blocks, the program expects a primary expression before the or
.
You don’t need to do this now or if you don’t think you should but if the answer has served you well you can accept it as correct. And you can vote for all the posts on the site that helped in any way. Check out the [tour].
– Maniero
in fact, your problem is not exactly with the OR operator; it is, as you wrote if. If you did if (z==x or y == z or x == y) Cout.... would have no problem.
– HiHello