Upcoming SlideShare
×

# Object-Oriented Programming 3

626 views

Published on

Control Structure

Published in: Technology, Education
0 Likes
Statistics
Notes
• Full Name
Comment goes here.

Are you sure you want to Yes No
• Be the first to comment

• Be the first to like this

Views
Total views
626
On SlideShare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
26
0
Likes
0
Embeds 0
No embeds

No notes for slide

### Object-Oriented Programming 3

1. 1. CHAPTER 3CONTROL STRUCTUREMr.Warawut Khangkhane-Mail: awarawut@hotmail.comSocial Media: www.facebook.com/AjWarawut
2. 2. Mr.Warawut Khangkhan (SequenceControl Statement) Chapter 3 Control Structure (SelectionControl Statement) (IterationControl Statement) 2
3. 3. Mr.Warawut Khangkhan Chapter 3 Control Structure Control Structure STATEMENT SEQUENCE CONTROL 3
4. 4. Mr.Warawut Chapter 3 Control Structure Khangkhan 4 F FF F
5. 5. Mr.Warawut Khangkhan Chapter 3 Control Structure Chapter 3 Control Structure STATEMENT SELECTION CONTROL 5
6. 6. Mr.Warawut Khangkhan F 4 Chapter 3 Control Structureif statementif…else statement True or Falsenested if statementswitch statement 6
7. 7. Mr.Warawut Chapter 3 Control Structure Khangkhan 7IF STATEMENT
8. 8. IF STATEMENT Mr.Warawut Khangkhanif (boolean_expression) { statements; Chapter 3 Control Structure}boolean_expression = F ˈ Fstatements = ˈ 8
9. 9. Mr.Warawut Chapter 3 Control Structure Khangkhan 9EX. CODE IF STATEMENT
10. 10. Mr.Warawut Chapter 3 Control Structure Khangkhan 10IF…ELSE STATEMENT
11. 11. IF…ELSE STATEMENT Mr.Warawut Khangkhanif (boolean_expression) { statement-1; Chapter 3 Control Structure} else { statement-2;}boolean_expression = F ˈ Fstatement-1 = ˈ 11statement-2 = ˈ
12. 12. Mr.Warawut Chapter 3 Control Structure Khangkhan 12EX. CODE IF…ELSESTATEMENT
13. 13. Mr.Warawut Chapter 3 Control Structure Khangkhan 13NESTED IF STATEMENT
14. 14. NESTED IF STATEMENT Mr.Warawut Khangkhanif (boolean_expression_1) { Chapter 3 Control Structure statement-1;} else if (boolean_expression_2) { statement-2;} else { statement-3;} 14
15. 15. Mr.Warawut Chapter 3 Control Structure Khangkhan 15EX. CODE NESTED IF ESTEDSTATEMENT
16. 16. Mr.Warawut Chapter 3 Control Structure Khangkhan 16SWITCH STATEMENT
17. 17. SWITCH STATEMENT Mr.Warawut Khangkhanswitch (expression) { case list_value_1: Chapter 3 Control Structure statement-1; break; case list_value_2: statement-2; break; … [default: statement; 17}
18. 18. Mr.Warawut Chapter 3 Control Structure Khangkhan 18EX. CODE SWITCHEX. CODE SWITCH WITCH WITCHSTATEMENTSTATEMENT
19. 19. Mr.Warawut Khangkhan Chapter 3 Control Structure Control Structure STATEMENT ITERATION CONTROL 19
20. 20. Mr.Warawut Khangkhan ( ) ˈ (False)while statement Chapter 3 Control Structuredo…while statementfor statement 20
21. 21. WHILE STATEMENT Mr.Warawut Khangkhan Chapter 3 Control Structurewhile (boolean_expression) { statements; 21}
22. 22. Mr.Warawut Chapter 3 Control Structure Khangkhan 22EX. CODE WHILE STATEMENT
23. 23. Mr.Warawut Chapter 3 Control Structure Khangkhan 23DO…WHILE STATEMENT
24. 24. DO…WHILE STATEMENT Mr.Warawut Khangkhando { statements; Chapter 3 Control Structure} while (boolean_expression); 24
25. 25. Mr.Warawut Chapter 3 Control Structure Khangkhan 25EX. CODE DO…WHILESTATEMENT
26. 26. Mr.Warawut Chapter 3 Control Structure Khangkhan 26FOR STATEMENT
27. 27. FOR STATEMENT Mr.Warawut Khangkhanfor (ctrl_var = val; bool_exp; inc./dec.) { statements; Chapter 3 Control Structure} 27
28. 28. Mr.Warawut Chapter 3 Control Structure Khangkhan 28EX. CODE FOR STATEMENT
29. 29. Mr.Warawut Khangkhan Chapter 3 Control Structure Control Structure STATEMENT CONTINUE BREAK & 29
30. 30. BREAK & CONTINUESTATEMENT Mr.Warawut Khangkhan break ˈ F continue ˈ FF Chapter 3 Control Structure 30
31. 31. Mr.Warawut Chapter 3 Control Structure Khangkhan 31EX. CODE BREAK STATEMENT
32. 32. Mr.Warawut Chapter 3 Control Structure Khangkhan 32EX. CODE CONTINUESTATEMENT