User Tools

Site Tools


cplusplus:control_structures_selection

This is an old revision of the document!


View page as slide show

Control Structures: Repetition in algorithms

Mithat Konar
2013-02-03

Introduction

  • Input validation
  • Sentinel/flag control
    • Menus
  • Counter control
  • Iterator

Input validation

  • Get input value from user
    While input value is not valid
    Get input value from user

Sentinel/flag control

  • Sentinel: Value(s) that indicate(s) a special condition; “special value”
  • Flag: sometimes a synonym for sentinel; sometimes means a sentinel that is a Boolean value
  • Sentinel controlled repetition:
    • Repeat as long as a sentinel condition is not matched
    • While input value is not -999
      do something
  • Input validation might be considered a special case of sentinel controlled repetition.
  • Another special case of sentinel controlled repetition can be used for menus
cplusplus/control_structures_selection.1361318622.txt.gz · Last modified: 2013/02/20 00:03 by mithat

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki