8 problem solving with the case logic structure

3,435
-1

Published on

Published in: Technology, Education
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
3,435
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
49
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

8 problem solving with the case logic structure

  1. 1. Data Structures and Algorithms The Case Logic Structure @ The case logic structure is made up of several or many sets of instructions, only one of which will be selected by the user and executed by the programmer. @ The form of the case logic structure is the following: CASE OF VARIABLE = constant 1: actions for VARIABLE = constant 1 = constant 2: actions for VARIABLE = constant 2 = constant 3: actions for VARIABLE = constant 3 . . OTHERWISE actions for VARIABLE = anything else END-OF-CASEProblem Solving with the Case Logic Structure *Property of STI Page 1 of 3
  2. 2. Data Structures and Algorithms The Case Logic StructureFlowchart Diagram for the Case Logic Structure A CASE OF VARIABLE = Constant 1 = Constant 2 = Constant 3 OTHERWISE INSTRUCTIONS INSTRUCTIONS INSTRUCTIONS INSTRUCTIONS BProblem Solving with the Case Logic Structure *Property of STI Page 2 of 3
  3. 3. Data Structures and Algorithms The Case Logic Structure A C1 = Constant 1 F T C2 = Constant 2 IF V = C1 C3 = Constant 3 F T IF V = C2 C4 = Constant 4 INSTRUCTIONS FOR v = C1 F T IF V = C3 INSTRUCTIONS FOR v = C2 F T IF V = C4 INSTRUCTIONS FOR v = C3 INSTRUCTIONS INSTRUCTIONS FOR v = C4 FOR v = C4Codes B @ Codes are characters, character strings, numbers, or some combination of these types of data that a programmer uses to name the options, the constants in a case structure.Problem Solving with the Case Logic Structure *Property of STI Page 3 of 3

×