if statements


Read With Formatting | Free Open Source Tutorials Account

C and C++ Programming
Thread: if statements


jack1234
Guys how do I write a statement that must accept a certain interger between a specified range before the rest of the program can continue?

If(n<8)
Printf(“please enter a num less than 8);

I want the program to stop here until a num less than 8 is entered then continue with the rest of the statements once a num less than 8 is entered.

Next how can I let the user enter a letter to exit the program or enter another letter to restart the program(start the program back from the first statement)
Is there a way a user can input a letter and a specific function or part of the codes can be executed as well?