So im a beginner in programming and i need help with replacing the if below with anything else.I tried to use bool but it didnt work.So if someone can help me thank you.
If you have to test that p is less than 10, you don't have many choices.
One option is the ternary operator:
p = (p<10) ? 1 : 0;
PLEASE ALWAYS USE CODE TAGS (the <> formatting button) when posting code.
It makes it easier to read your code and also easier to respond to your post. http://www.cplusplus.com/articles/jEywvCM9/
Hint: You can edit your post, highlight your code and press the <> formatting button.
That will perform an explicit conversion of a bool to an int. You can do the implicit p=(p<10); but it is less clear that you actually intended to convert the value. The compiler won't care, but the next programmer to maintain the code will.