Casio CFX-9970G Operating instructions

Programming
21-1 Before Programming
21-2 Programming Examples
21-3 Debugging a Program
21-4 Calculating the Number of Bytes Used by a Program
21-5 Secret Function
21-6 Searching for a File
21-7 Searching for Data Inside a Program
21-8 Editing File Names and Program Contents
21-9 Deleting a Program
21-10 Useful Program Commands
21-11 Command Reference
21-12 Text Display
21-13 Using Calculator Functions in Programs
Chapter
21

366
21-1 Before Programming
The programming function helps to make complex, often-repeated calculations
quick and easy. Commands and calculations are executed sequentially, just like
the manual calculation multistatements. Multiple programs can be stored under file
names for easy recall and editing.
Select the PRGM icon in the Main Menu and enter the PRGM Mode. When you
do, a program list appears on the display.
Selected memory area
(use
f
and
c
to move)
•{EXE}/{EDIT} ... program {execute}/{edit}
•{NEW} ... {new program}
P.382 •{DEL}/{DEL·A} ... {specific program}/{all program} delete
P.376 •{SRC}/{REN} ... file name {search}/{change}
• If there are not programs stored in memory when you enter the PRGM Mode,
the message “No Programs” appears on the display and only the NEW item
(3) is shown in the function menu.
The values to the right of the program list indicate the number of bytes used up
by each program.
File Name
Program
File Name
Program
File Name
Program

367
21-2 Programming Examples
Example 1 To calculate the surface area and volume of three regular
octahedrons of the dimensions shown in the table below
Store the calculation formula under the file name OCTA.
A
Length of One Side (A) Surface Area (S) Volume (V)
7 cm cm2cm3
10 cm cm2cm3
15 cm cm2cm3
The following are the formulas used for calculating surface area S and volume V
of a regular octahedron for which the length of one side is known.
2
S = 2 3 A2, V = –––– A3
3
When inputting a new formula, you first register the file name and then input the
actual program.
uu
uu
uTo register a file name
Example To register the file name OCTA
• Note that a file name can be up to eight characters long.
1. Display the program list menu and press 3(NEW) to display a menu, which
contains the following items.
•{RUN}/{BASE} ... {general calculation}/{number base} program input
P.374 •{
QQ
QQ
Q} ... {password registration}
•{SYBL} ... {symbol menu}
2. Input the name of the file.
OCTA
• The cursor changes form to indicate alpha character input.
• The following are the characters you can use in a file name:
A through Z, r,
θ
, spaces, [, ], {, }, ’, ”, ~, 0 through 9, ., +, –, ×, ÷
• Note, however, that vand .cannot be input for the name of a program
that contains binary, octal, decimal, or hexadecimal calculations.

368
• Use 1(RUN) to input a program for general calculations (a program to be
executed in the COMP Mode). For programs that involve number system
specifications, use 2(BASE). Note that programs input after pressing 2
(BASE) are indicated by Bto the right of the file name.
• Pressing 6(SYBL) displays a menu of symbols ( ’, ”, ~ ) that can be input.
• You can delete a character while inputting a file name by moving the cursor to
the character you want to delete and pressing D.
3. Press wto register the file name and change to the program input screen.
File name
• Registering a file name uses 17 bytes of memory.
• The file name input screen remains on the display if you press wwithout
inputting a file name.
• To exit the file name input screen and return to the program list without
registering a file name, press J.
• When you register the name of a program that contains binary, octal, decimal,
or hexadecimal calculations, the indicator Bis appended to the right of the file
name.
uu
uu
uTo input a program
The following items are included in the function menu of the program input screen,
which is used for program input.
P.379 •{TOP}/{BTM} ... {top}/{bottom} of program
P.378 • {SRC} ... {search}
• {MENU} ... {mode menu}
• {SYBL} ... {symbol menu}
uu
uu
uTo change modes in a program
• Pressing 4(MENU) while the program input screen is on the display causes
a mode change menu to appear. You can use this menu to input mode
changes into your programs.
•{STAT}/{MAT}/{LIST}/{GRPH}/{DYNA}/{TABL}/{RECR}
For details on each of these modes, see “To select an icon”, as well as the
sections of this manual that describe what you can do in each mode.
• The following menu appears whenever you press 4(MENU) while inputting a
program that involves number base specifications.
•{d ~ o}/{LOG}
21 - 2 Programming Examples
P.3

369
• Pressing 6(SYBL) displays a menu of symbols ( ’, ”, ~, *, /, # ) that can be
input into a program.
• Pressing !Zdisplays a menu of commands that can be used to change
set up screen settings inside a program.
•{ANGL}/{COOR}/{GRID}/{AXES}/{LABL}/{DISP}/{P/L}/{DRAW}/{DERV}/
{BACK}/{FUNC}/{SIML}/{S-WIN}/{LIST}/{LOCS}/{T-VAR}/{ΣDSP}/{RESID}
P.5 For details on each of these commands, see “Set Up Screen Function Key
Menus”.
The following function key menu appears if you press !Z while inputting a
program that contains binary, octal, decimal, or hexadecimal calculation.
•{Dec}/{Hex}/{Bin}/{Oct}
Actual program contents are identical to manual calculations. The following shows
how the calculation of the surface area and volume of a regular octahedron would
be calculated using a manual calculation.
Surface Area S .. c*!9d* <value of A> xw
Volume V ........... !9c/d* <value ofA> Mdw
You could also perform this calculation by assigning the value for the length of one
side to variable A.
Length of One Side A
............ <value of A> aaAw
Surface Area S .. c*!9d*aAxw
Volume V ........... !9c/d*aAMdw
If you simply input the manual calculations shown above however, the calculator
would execute them from beginning to end, without stopping. The following
commands make it possible to interrupt a calculation for input of values and
display of intermediate results.
?:This command pauses program execution and displays a question mark as a
prompt for input of a value to assign to a variable. The syntax for this com-
mand is: ? →<variable name>.
^^
^^
^:This command pauses program execution and displays the last calculation
result obtained or text. It is similar to pressing win a manual calculation.
P.383 • For full details on using these and other commands, see “Useful Program
Commands”.
Programming Examples 21- 2

370
The following shows examples of how to actually use the ? and ^commands.
!W4(?)aaA6(g)5(:)
c*!9d*aAx
6(g)5(^)
!9c/d*aAMd
!Q or JJ
uu
uu
uTo run a program
1. While the program list is on the display, use fand cto highlight the name
of the program you want to run.
2. Press 1(EXE) or wto run the program.
Let’s try running the program we input above.
Length of One Side (A) Surface Area (S) Volume (V)
7 cm 169.7409791 cm
2
161.6917506 cm
3
10 cm 346.4101615 cm
2
471.4045208 cm
3
15 cm 779.4228634 cm
2
1590.990258 cm
3
1(EXE) or w
hw
(Value ofA)
Intermediate result produced by
^
ww
baw
21- 2 Programming Examples

371
w
··
··
··
··
··
··
• Pressing wwhile the program’s final result is on the display re-executes the
program.
P.392 • You can also run a program while in the RUN Mode by inputting:
Prog ”<file name>” w.
• An error occurs if the program specified by Prog ”<file name>” cannot be
found.
Programming Examples 21- 2

372
21-3 Debugging a Program
A problem in a program that keeps the program from running correctly is called a
“bug,” and the process of eliminating such problems is called “debugging.” Either
of the following symptoms indicates that your program contains bugs and that
debugging is required.
• Error messages appearing when the program is run
• Results that are not within your expectations
uu
uu
uTo eliminate bugs that cause error messages
An error message, like the one shown below, appears whenever something illegal
occurs during program execution.
When such a message appears, press dor eto display the location where the
P.450 error was generated, along with the cursor. Check the “Error Message Table” for
steps you should take to correct the situation.
P.374 • Note that pressing dor ewill not display the location of the error if the
program is password protected.
uu
uu
uTo eliminate bugs that cause bad results
If your program produces results that are not what you normally expect, check the
P.379 contents of the program and make necessary changes. See “Editing File Names
and Program Contents” for details on how to change program contents.

373
21-4 Calculating the Number of Bytes Used by a
Program
This unit comes with 60 kbytes of memory. Abyte is a unit of memory that can be
used for storage of data.
There are two types of commands: 1-byte commands and 2-byte commands.
• Examples of 1-byte commands: sin, cos, tan, log, (, ),A, B, C, 1, 2, etc.
• Examples of 2-byte commands: Lbl 1, Goto 2, etc.
While the cursor is located inside of a program, each press of dor ecauses
the cursor to move one byte.
• You can check how much memory has been used and how much remains at
any time by selecting the SYS Mode and entering the memory status screen.
See “Memory Status” for details.
P.24

374
21-5 Secret Function
When inputting a program, you can protect it with a password that limits access to
the program contents to those who know the password. Password protected
programs can be executed by anyone without inputting the password.
uu
uu
uTo register a password
Example To create a program file under the name AREA and protect it
with the password CASIO
1. While the program list is on the display, press 3(NEW) and input the file
name of the new program file.
3(NEW)
AREA
2. Press 5(Q) and then input the password.
5(Q)
CASIO
P.367 • The password input procedure is identical to that used for file name input.
3. Press wto register the file name and password. Now you can input the
contents of the program file.
• Registration of a password uses 16 bytes of memory.
• Pressing wwithout inputting a password registers the file name only, without
a password.
4. After inputting the program, press !Qto exit the program file and return
to the program list. Files that are password protected are indicated by an
asterisk to the right of the file name.
uu
uu
uTo recall a program
Example To recall the file named AREA which is protected by the
password CASIO
1. In the program list, use fand cto move the highlighting to the name of the
program you want to recall.

375
2. Press 2(EDIT).
3. Input the password and press wto recall the program.
• The message “Mismatch” appears if you input the wrong password.
Secret Function 21- 5

376
21-6 Searching for a File
There are three different methods for searching for a specific file name.
uu
uu
uTo find a file using scroll search
Example To use scroll search to recall the program named OCTA
1. While the program list is on the display, use
fand cto scroll through the list of
program names until you find the one you
want.
123456
2. When the highlighting is located at the name
of the file you want, press 2(EDIT) to
recall it.
uu
uu
uTo find a file using file name search
Example To use file name search to recall the program named OCTA
1. While the program list is on the display, press 3(NEW) and input the name of
the file you want to find.
P.374 • If the file you are looking for is password protected, you should also input the
password.
3(NEW)
OCTA
2. Press wto recall the program.
• If there is no program whose file name matches the one you input, a new file is
created using the input name.
uu
uu
uTo find a file using initial character search
Example To use initial character search to recall the program named
OCTA
1. While the program list is on the display, press 6(g) 1(SRC) and input the
initial characters of the file you want to find.
6(g)1(SRC)
OCT

377
2. Press wto search.
• All files whose file names start with the characters you input are recalled.
• If there is no program whose file name starts with the characters you input, the
message “Not Found” appears on the display. If this happens, press Jto
clear the error message.
3. Use fand cto highlight the file name of the program you want to recall
and then press 2(EDIT) to recall it.
Searching for a File 21-
6

378
21-7 Searching for Data Inside a Program
Example To search for the letter “A” inside the program named OCTA
1. Recall the program.
2. Press 3(SRC) and input the data you want to search for.
3(SRC)
aA
• You cannot specify the newline symbol (_) or display command (^) for the
search data.
3. Press wto begin the search. The contents of the program appears on the
screen with the cursor located at the first instance of the data you specified.
Indicates search operation is in progress
4. Press wto find the next instance of the data.
• If there is no match inside the program for the data you specified, the contents
of the program appear with the cursor located at the point from which you
started your search.
• Once the contents of the program are on the screen, you can use the cursor
keys to move the cursor to another location before searching for the next
instance of the data. Only the part of the program starting from the current
cursor location is searched when you press w.
• Once the search finds an instance of your data, inputting characters or moving
the cursor causes the search operation to be cancelled (clearing the Search
indicator from the display).
• If you make a mistake while inputting characters to search for, press Ato
clear your input and re-input from the beginning.

379
21-8 Editing File Names and Program Contents
uu
uu
uTo edit a file name
Example To change the name of a file from TRIANGLE to ANGLE
1. While the program list is on the display, use fand cto move the highlight-
ing to the file whose name you want to edit and then press 6(g) 2(REN).
2. Make any changes you want.
DDD
3. Press wto register the new name and return to the program list.
• If the modifications you make result in a file name that is identical to the name
of a program already stored in memory, the message “Already Exists”
appears. When this happens, you can perform either of the following two
operations to correct the situation.
• Press eor dto clear the error and return to the file name input screen.
• Press Ato clear the new file name and input a new one.
uu
uu
uTo edit program contents
1. Find the file name of the program you want in the program list.
2. Recall the program.
• The procedures you use for editing program contents are identical to those
P.20 used for editing manual calculations. For details, see “Editing Calculations”.
• The following function keys are also useful when editing program contents.
1(TOP) ....... Moves the cursor to the top
of the program
2(BTM)....... Moves the cursor to the
bottom of the program
Example 2 To use the OCTA program to create a program that calculates
the surface area and volume of regular tetrahedrons when the
length of one side is known
P.367

380
Use TETRAas the file name.
Length of One Side (A) Surface Area (S) Volume (V)
A7 cm cm2cm3
10 cm cm2cm3
15 cm cm2cm3
The following are the formulas used for calculating surface area S and volume V
of a regular tetrahedron for which the length of one side is known.
2
S = 3 A2, V = ––––A3
12
Use the following key operations when inputting the program.
Length of One Side A ..!W4(?)aaA6(g)5(:)
Surface Area S ............!9d*aAx6(g)5(^)
Volume V .....................!9c/bc*aAMd
Compare this with the program for calculating the surface area and volume of a
regular octahedron.
Length of One Side A ..!W4(?)aaA6(g)5(:)
Surface Area S ............c*!9d*aAx6(g)5(^)
Volume V .....................!9c/d*aAMd
As you can see, you can produce the TETRAprogram by making the following
changes in the OCTAprogram.
• Deleting c*(underlined using a wavy line above)
• Changing dto bc(underlined using a solid line above)
Let’s edit OCTA to produce the TETRAprogram.
1. Edit the program name.
6(g)2(REN)TETRA
w
2. Edit the program contents.
2(EDIT)
21 - 8 Editing File Names and Program Contents
eeeeDD

381
cd
382
21-9 Deleting a Program
There are two methods for deletion of a file name and its program.
uu
uu
uTo delete a specific program
1. While the program list is on the display, use fand cto move the highlight-
ing to the name of the program you want to delete.
2. Press 4(DEL).
3. Press 1(YES) to delete the selected program or 6(NO) to abort the
operation without deleting anything.
uu
uu
uTo delete all programs
1. While the program list is on the display, press 5(DEL·A).
2. Press 1(YES) to delete all the programs in the list or 6(NO) to abort the
operation without deleting anything.
P.26 • You can also delete all programs using the SYS Mode. See “Clearing Memory
Contents” for details.

383
21-10 Useful Program Commands
In addition to calculation commands, this calculator also includes a variety of
relational and jump commands that can be used to create programs that make
repeat calculations quick and easy.
Program Menu
Press !Wto display the program menu.
•{COM}/{CTL}/{JUMP}/{CLR}/{DISP}/{REL}/{I/O}
•{?} ... {input command}
• {^} ... {output command}
• {:} ... {multi-statement command}
kk
kk
kCOM (program command menu)
Selecting {COM} from the program menu displays the following function menu
items.
•{If}/{Then}/{Else}/{I-End}/{For}/{To}/{Step}/{Next}/{Whle}/{WEnd}/{Do}/{Lp-W}
... {If}/{Then}/{Else}/{IfEnd}/{For}/{To}/{Step}/{Next}/{While}/{WhileEnd}/{Do}/
{LpWhile} command
kk
kk
kCTL (program control command menu)
Selecting {CTL} from the program menu displays the following function menu
items.
•{Prog}/{Rtrn}/{Brk}/{Stop} ... {Prog}/{Return}/{Break}/{Stop} command
kk
kk
kJUMP (jump command menu)
Selecting {JUMP} from the program menu displays the following function menu
items.
•{Lbl}/{Goto} ... {Lbl}/{Goto} command
•{⇒} ... {jump command}
•{Isz}/{Dsz} ... {jump and increment}/{jump and decrement}
kk
kk
kCLR (clear command menu)
Selecting {CLR} from the program menu displays the following function menu
items.
•{Text}/{Grph}/{List} ... clears {text}/{graph}/{list}

384
kk
kk
kDISP (display command menu)
Selecting {DISP} from the program menu displays the following function menu
items.
u{Stat}/{Grph}/{Dyna} ... {statistical graph}/{graph}/{Dynamic Graph} draw
u{F-Tbl} ... {Table & Graph command menu}
The following are the items that appear in the above menu.
•{Tabl}/{G-Con}/{G-Plt} ... {DispF-Tbl}/{DrawFTG-Con}/{DrawFTG-Plt}
command
u{R-Tbl} ... {recursion calculation and recursion fomula}
The following are the items that appear in the above menu.
•{Tabl}/{Web}/{an-Cn}/{Σa-Cn}/{an-Pl}/{Σa-Pl} ... {DispR-Tbl}/{DrawWeb}/
{DrawR-Con}/{DrawRΣ-Con}/{DrawR-Plt}/{DrawRΣ-Plt} command
kk
kk
kREL (conditional jump relational operator commands)
Selecting {REL} from the program menu displays the following function menu
items.
•{=}/{
GG
GG
G}/{>}/{<}/{
≥}/{≤} ... {=}/{G}/{>}/{<}/{≥}/{≤} relational operators
kk
kk
kI/O (input/output commands)
Selecting {I/O} from the program menu displays the following function menu items.
•{Lcte}/{Gtky}/{Send}/{Recv} ... {Locate}/{Getkey}/{Send(}/{Receive(} command
• The appearance of the function menu differs slightly for a program that
contains binary, octal, decimal, or hexadecimal calculation, but the functions in
the menu are the same.
21- 10 Useful Program Commands
Other manuals for CFX-9970G
21
Table of contents
Other Casio Calculator manuals

Casio
Casio FX-9700GE User manual

Casio
Casio 2296 User manual

Casio
Casio fx-7400G Instruction and safety manual

Casio
Casio FX-912W User manual

Casio
Casio FX-CG500 User manual

Casio
Casio GR-12C User manual

Casio
Casio FX-P401 User manual

Casio
Casio ALGEBRA FX 2.0 Plus Instruction and safety manual

Casio
Casio fx-7400G User manual

Casio
Casio FX-702P User manual

Casio
Casio FX-9750G User manual

Casio
Casio fx-82MS Manual

Casio
Casio fx-580 User manual

Casio
Casio fx-7400G PLUS User manual

Casio
Casio FX-9750G User manual

Casio
Casio CFX-9970G User manual

Casio
Casio DR-320ER User manual

Casio
Casio SF-A7 Troubleshooting guide

Casio
Casio MJ-100T User manual

Casio
Casio fx-3900Pv User manual