Presentation is loading. Please wait.

Presentation is loading. Please wait.

ا.ريم العتيبي ا.ندى الطويرقي ا.هدى السفياني

Similar presentations


Presentation on theme: "ا.ريم العتيبي ا.ندى الطويرقي ا.هدى السفياني"— Presentation transcript:

1 ا.ريم العتيبي ا.ندى الطويرقي ا.هدى السفياني
المملكة العربية السعودية Kingdom of Saudi Arabia جامعة الطائف Taif University كلية الحاسبات وتقنية المعلوماتCollege of Computer Science and IT قسم علوم الحاسب Computer Science Department Programming 1 Lecture#6 ا.ريم العتيبي ا.ندى الطويرقي ا.هدى السفياني

2 Compound (Block of) Statements
The if and if. . .else structures control only one statement at a time. Suppose you want to execute more than one statement if the expression evaluates to true. To permit this, c++ provides compound statements.

3

4 Multiple Selections: Nested if
Some problems require the implementation of more than two alternatives. You can include multiple selection in a program by using an if. . .else structure if the action statement itself is an if or if. . .else statement. When one control statement is located within another, it is said to be nested.

5

6 switch Structures there are two selection structures in C++. The first selection structure, which is implemented with if and if. . .else statements, usually requires the evaluation of a (logical) expression. The second selection structure, which does not require the evaluation of a logical expression, is called the switch structure. C++’s switch structure gives the computer the power to choose from among many alternatives.

7 A general syntax of the switch statement

8

9

10 Break statement To see the effect of break statements, we will delete it from previous program and recompile it.

11

12


Download ppt "ا.ريم العتيبي ا.ندى الطويرقي ا.هدى السفياني"

Similar presentations


Ads by Google