Enter your Sign-on user name and password.

Forgot password?
  • Follow us on:
Loading video...

Start Learning Now

Our free lessons will get you started (Flash® 10 required).
Get immediate access to our entire library.

Sign up for Educator.com

Features Overview

  • Get on-demand access to our complete library
  • Search and jump to exactly what you need to learn
  • Track your progress
  • Download practice and lesson files
  • *Ask questions and get answers from our community & instructors

Branching

  • Branching allows program to process different code blocks depending on testable situations
  • Variables have a “scope” that is limited to the code block
  • The ‘if” statement processes a code block if its expression is true
  • The “else” clause processes a code block if the expression for its corresponding “if” statement is false
  • The ‘if” statement and/or its “else” clause may have more “if” statements nested in its code block
  • A special case of “else” nesting is the “chained if”, where a number of cases may be tested until one evaluates to true
  • A “switch” statement works like a “chained if” for an integer expression– the case that matches the integer value is processed
  • A “conditional” statement uses the “ternary operator” to provide a value conditional on its expression – the first value if true, or the second value if false
  • A “goto” statement unconditionally branches to another location in the code, but is known to lead to poor quality software
  • Here is a link that includes a discussion of various kinds of branching statements: http://www.cplusplus.com/doc/tutorial/control/

Branching

Lecture Slides are screen-captured images of important points in the lecture. Students can download and print out these lecture slide images to do practice problems as well as take notes while watching the lecture.

Computer Science: Introduction to C++