I'm making a program and want to use an if statement to add a 0 to output if the numbers = 0-9. I know how to do an if statement like:
int number=0; if (number==5){ cout << " whatever " << endl; } Is there any way to do somthing like this?
int number=0; if (number==1-9){ cout << " whatever " endl; Thankyou for the help, it is well apreciated!
Use a compound conditional like this:
if(number >0 && number < 10)
Logical AND - &&, Logical OR - ||, Logical Inversion - !
Some things you should get comfortable with.