LectureSix - C+ Programming Lecture 6 Control Structure I...

Info iconThis preview shows pages 1–5. Sign up to view the full content.

View Full Document Right Arrow Icon
Lecture 6 Control Structure I (Selection) – Part I By Ghada Al-Mashaqbeh The Hashemite University Computer Engineering Department
Background image of page 1

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

View Full DocumentRight Arrow Icon
The Hashemite University 2 Control Structures ± Sequential execution ± Statements executed one after the other in the order written ± Transfer of control ± When the next statement executed is not the next one in sequence ± Bohm and Jacopini: all programs written in terms of 3 control structures (without any goto statement): ± Sequence structure ± Built into C++. Programs executed sequentially by default. ± Selection structures ± C++ has three types - if , if/else , and switch ± Repetition structures ± C++ has three types - while , do/while , and for
Background image of page 2
The Hashemite University 3 Combination of Control Structures ± Two types of control structures combination: ± Control structure stacking: use them one after the other. ± Control structure nesting: use one control structure inside the body of another control structure.
Background image of page 3

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

View Full DocumentRight Arrow Icon
The Hashemite University 4 The if Selection Structure I ± Selection structure ± used to choose among alternative courses of action ± Pseudocode example: If student’s grade is greater than or equal to 60 Print “Passed” ± If the condition is true ± print statement executed and program goes on to next
Background image of page 4
Image of page 5
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 10/29/2010 for the course COMPUTER E 2010 taught by Professor Ghadaal-mashaqbeh during the Spring '10 term at Hashemite University.

Page1 / 12

LectureSix - C+ Programming Lecture 6 Control Structure I...

This preview shows document pages 1 - 5. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online