Hi I am creating a simple password program. The program requires the user to enter an account number and password. The following code works fine however the only problem I have is after 3 incorrect attempts I want the program to terminate with an appropriate message. I can't figure out how to get the loop to stop after 3 incorrect attempts and was hoping someone could help me with this. Thanks!
In the code below the integer loop_count is initialised to 0, each time the loop runs it is compared to 3 and then incremented (tip: int++ is use then increment ++int is increment then use). If the count is equal to 3 then the program prints a string and exits with an exits status of 1.
Exit status of 0 implies everything was fine and the program exited normally. Any other number generally means something went wrong, but is program specific. This is why most main functions end with "return 0".