-
Keeping Track
How would you keep track of how many times a program has ran through a loop? For example, program asks user to continue (y/n), if they enter y, program continues then asks again once finished with task (continue? (y/n)). If n, then program ends. I want to keep track of how many times the user has entered y to continue the program, so I can record how many attempts they have made and then print out the number of attempts after the user quits.
-
Re: Keeping Track
Just create an integer variable that is incremented every time the loop is completed.
-
Re: Keeping Track
So simple. Sometimes asking a question will help my brain ignite to solve a problem. Thanks for responding.