Casio Z1 Gr User Manual
Here you can view all the pages of manual Casio Z1 Gr User Manual. The Casio manuals for Personal Computer are available online for free. You can easily download all the documents as PDF.
Page 31
31 .. .. (displays line 30 to 60) 30 INPUT “H=”;H 40 V=PI+R^2*H 50 PRINT “V=”;V 60 END Here, a correction will be made in line 40. .. (Displays line 40 to 60, line 40 at the upper line of the display) .. (Enables program editing) 40 V=PI+R^2*H .. .. .. .. .. .. .. .*. . . (Moves cursor and makes correction) 40 V=PI*R^2*H 50 PRINT “V=”;V 60 END BRK ( BRK key exits EDIT mode) Ready P0 5.4 BASIC Program Execution 5.4.1 Program Execution Once a BASIC program is stored in memory, it can be...
Page 32
32 1. Executions that produce errors 2. Irregular execution that do not produce errors (mostly logic errors) Execution that produce errors Simple programming errors. This is the most common type of program error and is generally caused by mistakes in program syntax. Such errors result in the following message being displayed: SN error P0-10 This message indicates that a syntax error has been detected in line 10 of the program stored in program area 0. The indicated program line should be chacked and...
Page 33
33 of the data read from line 180, followed by the square root and cube root of the sum. Program execution is terminated when the operator enters a zero. 10 S=0 20 RESTORE 30 INPUT N 40 IF N>5 THEN N=5 50 IF N=0 THEN GOTO 130 60 FOR I=1 TO N 70 READ X 80 S=S+X 90 NEXT I 100 GOSUB 140 110 PRINT S;Y;Z 120 GOTO 10 130 END 140 REM SQUARE/CUBE ROOT 150 Y=SQR S 160 Z=CUR S 170 RETURN 180 DATA 9,7,20,28,36 Clear current total assigned to S Specifies read operation should begin with 1st data item Input the...
Page 34
34 and assigns a value of 5 to N when the original value is greater. When a value of 5 or less is originally assigned to N, execution proceeds to the next line, with N retaining its original value. Line 50 checks whether or not value assigned to N is zero. In the case of zero, program execution jumps to nine 130, while execution proceeds to next line (line 60) when N is any other value besides zero. Note: Line 50 can also be abbreviated as follows: 50 IF N=0 THEN 130 5.5.6 GOTO The GOTO command (lines...
Page 35
35 Note: GOSUB routines can also be used to branch to other program areas, as in GOSUB #3 (branches to program area 3). Note, however, that a return must be made back to original program area using the RETURN command before an END command is executed. 5.5.10 Labels You have the possibility to assign label names to program lines. This feature allows an easier understanding of the program structure, especially GOTO and GOSUB statements. We will modify the program of chapter 5.5 using labels: 10...
Page 36
36 5.6 Operators The following are the operators used for calculations, which involves variables. Arithmetic operators Signs Addition Subtraction Multiplication Division Power Integer division Integer remainder of integer division +,- + - * / ^ ¥ MOD Relational operators Equal to Does not equal Less than Grater than Less than or equal to Grater than or equal to = , >< < > =>, , >= Logical operators Negation Logical product Logical sum Exclusive OR NOT AND OR XOR Operators String operator...
Page 37
37 Logical Operators The operands of logical operations are truncated to integers and the operation is performed bit-by-bit to obtain the result. X Y X AND Y X OR Y X XOR Y NOT X NOT Y 0 0 0 0 0 1 1 0 1 0 1 1 1 0 1 0 0 1 1 0 1 1 1 1 1 0 0 0 String Operators Strings may be concatenated using a + sign. The result of the operation (including intermediate results) may not exceed 255 characters. EXAMPLE: A$=”AD”+”1990” The above example results in the string “AD1990” being assigned to variable A$....
Page 38
38 5.7.2 Variables Numeric Variables The following shows the numeric variables included in the sample program on page 33: PROGRAM 20 R=15 30 INPUT “H=”;H 40 V=PI*R^2*H NUMERIC VARIABLES R H V Numeric variables are so named because their contents are handled as numbers. Numeric variable names can be up to 15 characters long, and are used within programs to store calculation results or constants in memory. In the sample program, the value 15 is stored in H, while V, which is the result of the...
Page 39
39 EXAMPLE: Declare array variable A for storage of 9 numeric data items. 10 DIM A (8) Note: a declared value of 8 makes possible to store 9 data items. EXAMPLE: Recall value stored in element 4 of array A Y=A(4) Or X=4:Y=A(X) The value that specifies an element in an array (4 above) is called a subscript. Until now, the only arrays covered have been those formed by a single line of elements or “boxes”. These are known as “one-dimensional” arrays. Arrays may also contain more than one dimension...
Page 40
40 5.7.3 Summary Variable types The three following types of variable are available for use with this unit. 1. Numeric variables (up to 12-digit mantissa) A, a, NUMBER, POINTS 2. String variables (up to 255 characters) A$, STRING$ 3. Array variables Numeric array A(10), XX(3,3,3) String array A$(10), ARRAY$(2,2) Variable names Variable names can consist of upper, lower case or numeric characters, but a numeric character cannot be used in the first position of the variable name (i.e. 1AE, 3BC$ are...
All Casio manuals