Control Structures.pptx

Control Structures.pptx - Week 9 Control Structures What is...

Info icon This preview shows pages 1–7. Sign up to view the full content.

Control Structures Week 9
Image of page 1

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

What is a control structure? A control structure is a block of programming that analyzes variables and chooses a direction in which to go based on given parameters. The 3 basic types of control structure are: Sequential Selection Repetition (Iteration)
Image of page 2
Control structures
Image of page 3

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

Sequential Control Structure The default control structure Example: Input number between 1 and 10; Input second number between 11 and 20; Add first number to second number; Statements are executed line by line, in the order that they appear
Image of page 4
Selection Control Structure Selection is used to test a condition Then a sequence of statements is executed based on whether the condition is true or false The program has to choose between 2 or more alternative paths
Image of page 5

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

Selection Control Structure cont.. Example If age1 is greater than age2; Then print “Age1 is greater than Age2” There are 4 main types of selection structure: if statement -
Image of page 6
Image of page 7
This is the end of the preview. Sign up to access the rest of the document.
  • Fall '16
  • Anne

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern