1 / 13

計算機程式 C omputer Programming Language Lecture 3 邏輯運算

計算機程式 C omputer Programming Language Lecture 3 邏輯運算. 郭修伯 助理教授 (5488). 流程判斷. If … then ...end if. 縮排. == /= > >= < <=. . EQ. .NE. .GT. .GE. .LT. .LE. 邏輯判斷. . AND. .OR. .NOT. .EQV. .NEQV. 多重判斷. 三個獨立的判斷式 if … then …end if 最沒效率 多重判斷 if … else if … else … end if 較有效率

leyna
Download Presentation

計算機程式 C omputer Programming Language Lecture 3 邏輯運算

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 計算機程式Computer Programming LanguageLecture 3 邏輯運算 郭修伯 助理教授 (5488)

  2. 流程判斷 • If … then ...end if

  3. 縮排

  4. == /= > >= < <= .EQ. .NE. .GT. .GE. .LT. .LE. 邏輯判斷 • .AND. • .OR. • .NOT. • .EQV. • .NEQV.

  5. 多重判斷 • 三個獨立的判斷式 • if … then …end if • 最沒效率 • 多重判斷 • if … else if … else … end if • 較有效率 • Select case

  6. select case ( variable) case (A) ... case (B) ... case (C) … case default … end select case (1) case (1:3) case (1: ) case ( :5) case (1,3,5) • 只能是固定常數,不能是變數 • 不能使用浮點數及複數

  7. true false true false . . . true false case a action(s) case b action(s) case z action(s) default action(s) case a case b case z

  8. 巢狀的邏輯判斷 if if else if end if else if end if 縮排

  9. Float的邏輯判斷 Usually set an error value!

  10. GOTO • 盡量少用,會破壞程式的可讀性 • 習題說明 • 1 傳回最接近的整數值

  11. 習題說明 • 3 • 習題說明 • 2

  12. 習題說明 • 4

  13. 邏輯判斷作業

More Related