Object-Oriented Programming 3

  • 357 views
Uploaded on

Control Structure

Control Structure

More in: Technology , Education
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads

Views

Total Views
357
On Slideshare
0
From Embeds
0
Number of Embeds
0

Actions

Shares
Downloads
20
Comments
0
Likes
0

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

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