HP 12C Financial Programmable Calculator Podręcznik Użytkownika Strona 108

  • Pobierz
  • Dodaj do moich podręczników
  • Drukuj
  • Strona
    / 211
  • Spis treści
  • BOOKMARKI
  • Oceniono. / 5. Na podstawie oceny klientów
Przeglądanie stron 107
108 Section 9: Branching and Looping
File name: hp 12c_user's guide_English_HDPMBF12E44 Page: 108 of 209
Printered Date: 2005/7/29 Dimension: 14.8 cm x 21 cm
The program line immediately following that containing the conditional test
instruction can contain any instruction; however, the most commonly used
instruction there is
i
. If a
i
instruction follows a conditional test instruction,
program execution branches elsewhere in program memory if the condition is true
and continues with the next line in program memory if the condition is false.
Example:
The following program calculates income tax at a rate of 20% on
incomes of $20,000 or less and 25% on incomes of more than $20,000. To
conserve program lines, the program assumes that the test value — 20,000 — has
been stored in register R
0
and the tax rates — 20 and 25 — have been stored in
registers R
1
and R
2
, respectively.
Note: If a program requires that certain numbers be in the X- and
Y-registers when instructions such as o are executed, it is extremely helpful
when writing the program to show the quantities in each register after each
instruction is executed, as in the following diagram.
Przeglądanie stron 107
1 2 ... 103 104 105 106 107 108 109 110 111 112 113 ... 210 211

Komentarze do niniejszej Instrukcji

Brak uwag