CIS 1057 Chapter Notes - Chapter 7: Infinite Loop, Function Prototype

29 views3 pages

Document Summary

Conditional loops repeat until a desired condition is met. E. g. until a proper input is given. Placing loop processing in a function subprogram simplifies the main function. It is good practice to leave a comment above a loop detailing its purpose. Sentinel values are end markers that follow the last item in a list of data. Sentinel-controlled loops repeat and test data until a sentinel value occurs, which causes the loop to exit. A sentinel loop can be implemented in both a for and while statement. Iterates through data until an endfile character has been reached. If a while loop encounters faulty data, it can become an infinite loop, as the complement to the loop repetition condition will never be met. As other control structures, loops can be placed within another to form nested loops. With each repetition of the outer loop, the inner loop is reentered and their loop control variable is reevaluated.

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents