Download presentation
Presentation is loading. Please wait.
Published byFelix Fleischer Modified over 5 years ago
1
Wrapup which is the document write that says the end.
2
This loop has three requirements to control processing
This loop has three requirements to control processing. I iniitialize ct at 1, inside the loop I increment ct by 1 so it will change and the processing is controlled with a test or condition that compares ct to data_input. Since ct is constantly incrementing, eventually it will not be <= to data_input and the loop will stop.
3
This time I entered 1 for data_input so it processed once while the ct of 1 was = data_input of 1.
4
This time I entered 0 as the data_input so no processing was done in the while loop. The comparison compared ct which was 1 to data_input which was 0 and ct was not less than or equal to data_input.
5
This is the do loop with the condition at the end
This is the do loop with the condition at the end. Therefore it is always executed once. I take in data_input, I set ct = 1 and then I enter the loop and write out a line and increment ct. Then I compare to see if I should do the loop again. At this point ct is 2 and data_input is the 6 that I entered, so the loop is done again.
7
Note that If I entered a 0 I would get the same result because it would process once and then ct would be 2 and data_input would be 0 so it would not process again.
9
Processing does the loop multiple times.
Wrapup is executed once when processing is complete. I check the total_Points and determine the message.
19
This prints out the total for each player as long as the user enters Y to continue. Any other entry would end the loop.
20
In class work was to add an if statement to tell which player won or if it was a tie.
21
example for sample if.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.