SlideServe
Menu
Préférences
© SlideServe · v2026

Introduction to Computer Programming with Decision Structures and Loops

jagger avatar
15 diapositives · 303 Views · Jul 13, 2014

This guide provides an overview of fundamental concepts in computer programming, focusing on selection (decision-making), loops, and functions. Learn about conditional statements, such as if-else structures and nested conditions, to handle multiple selections effectively. The content also covers practical examples, including handling legal age checks and grading systems. Additionally, graphics and other tools for programming are briefly introduced. This material is suitable for beginners looking to grasp the essential structures necessary for developing programs.

Introduction to Computer Programming with Decision Structures and Loops - slide 1
01 / 15Introduction to Computer Programming with Decision Structures and Loops
1 / 17

Télécharger la présentation

Introduction to Computer Programming with Decision Structures and Loops
Une image / un lien ci-dessous est fourni (tel quel) pour télécharger la présentation

Politique de téléchargement : le contenu du site vous est fourni TEL QUEL pour votre information et votre usage personnel ; il ne peut être vendu, concédé sous licence ni partagé sur d’autres sites sans l’accord de son auteur.Le contenu vous est fourni TEL QUEL, pour votre information et votre usage personnel uniquement. Téléchargez la présentation en cliquant sur ce lien. Lors du téléchargement, si vous ne parvenez pas à télécharger une présentation, l’éditeur a peut-être supprimé le fichier de son serveur.Pendant le téléchargement, si vous ne parvenez pas à obtenir une présentation, le fichier a peut-être été supprimé par l’éditeur.

F I N

Plus de contenu associé

Transcription de la présentation
  1. CSC115 Introduction to Computer Programming Zhen Jiang Dept. of Computer Science West Chester University West Chester, PA 19383 zjiang@wcupa.edu

  2. Table of Contents • Structure • Selection (Decision) • Loop • Function • Interesting features • Graphics • Other tools

  3. Selection (Decision) • Price is right. • Sample execution (click on this link to try)

  4. No Yes Condition Action 1 Action 2 Action 3

  5. Legal age to have driver’s license

  6. If block if condition then action 1 (statements 1) else action 2 (statements 2) end if action 3 (statement 3)

  7. Legal age to have driver’s license

  8. Condition • Simple condition • Format <Value> <relational operators> <Value> • Number value relational operators =, <>, <, >, <=, >= • String value relational operators =, <> • Complex condition • And, or, not • Truth table

  9. Development Process • Identify two exclusive options • Implement each handling in different action parts • Identify the situation (values) for option selection • Make a condition so that all the situation value for option part 1 will lead to this condition true. • Verify all the situation value for option part 2 will lead to this condition false, otherwise, revise the above condition!

  10. Multiple selection • Nested if block • Example: letter grade

  11. Comments: • Nested if block for multiple section problem If then case 1 Else if then case 2 else … end if End if

  12. Try 2 • Dim x as integer, y as integer • x = text1.text • y=0 • if x > 3 then • y =1 • if x >10 then • y = 2 • else • y = 3 • End if • End if • Listbox1.Items.Add( y ) • Dim x as integer, y as integer • x = text1.text • y=0 • if x > 3 then • y =1 • if x > 10 then • y = 2 • End if • else • y = 3 • End if • Listbox1.Items.Add( y )

  13. Dim x as integer, y as integer • x = text1.text • y=0 • if x > 3 then • y =1 • if x >10 then • y = 2 • else • y = 3 • End if • End if • Listbox1.Items.Add( y ) • Dim x as integer, y as integer • x = text1.text • y=0 • if x > 3 then • y =1 • if x > 10 then • y = 2 • End if • else • y = 3 • End if • Listbox1.Items.Add( y )

  14. Select block • Select case • A constant • A variable • An expression • Is • Range • Else • or case