Home > Casio > Personal Computer > Casio Z1 Gr User Manual

Casio Z1 Gr User Manual

    Download as PDF Print this page Share this page

    Have a look at the manual Casio Z1 Gr User Manual online for free. It’s possible to download the document as PDF or print. UserManuals.tech offer 338 Casio manuals and user’s guides for free. Share the user manual or guide on Facebook, Twitter or Google+.

    							  111  6.3 C Command Reference 6.3.1 Manual Commands  RUN  PURPOSE: Execution of a C program. EXAMPLE: RUN run RUN>”PRN:” PARAMETERS:  You can specify the output console being the printer instead of the screen. EXPLANATION: Execution starts at the beginning of the main() function of the program currently loaded.  EDIT  PURPOSE: Writing or editing a C program. EXAMPLE: EDIT edit EXPLANATION: Enters the editor and opens the program area F 0-9 currently selected.  TRON  PURPOSE: Entering the TRACE mode for program debugging. EXAMPLE: TRON tron EXPLANATION: 1. If you run a program in TRACE mode, computer will stop at each statement showing program area number (F0-9), line number and statement. 2. After each statement, prompt “Break?_” appears. Press . . or .T. key to execute the next statement. 3. Press  N  when prompted “Break?_” to exit the TRACE mode and finish executing the program. 4. During TRACE mode execution of a program, you can press  D  when prompted “Break?_” to evaluate the content of variables. The “var>_” prompt allows you entering the name of the variable you want to evaluate. Entering only . . will resume the TRACE mode execution. 5. You can press BRK to exit the program, but stay in TRACE mode. This is useful if you want to re-run the program because you missed something.  TROFF  PURPOSE: Cancelling TRACE mode to switch back to normal program execution. EXAMPLE: TROFF troff  
    						
    							  112 6.3.1 Fundamental commands  abort()  PURPOSE: Program termination. FORMAT: void abort(); EXPLANATION: 1. Calling abort() function will cause the program to terminate immediately, indicating an unsuccessful termination. 2. The following may occur: file buffers are not flushed, streams are not closed, and temporary files are not deleted. 3. In ANSI C, abort() function is part of library stdlib.  exit()  PURPOSE: Program termination. FORMAT: void exit(); EXPLANATION: 1. Calling exit() function will cause the program to end normally. 2. In ANSI C, exit() function is part of library stdlib. And allows to pass a parameter indicating the termination status to the operating system.  breakpt()  PURPOSE: Stops program execution like in the TRACE mode. FORMAT: void breakpt(); EXPLANATION: 1. The TRACE mode stops at each statement. I you just want to investigate a certain statement of your program, you can add a breakpt() statement. 2. Program will stop showing the “Break?_” prompt. You can - Press  D  to evaluate the content of variables. The “var>_” prompt allows you entering the name of the variable you want to evaluate. Entering only . . will go back to the “Break?_” prompt. - Press . . to carry on program execution. - Press  T  to enter TRACE mode (see TRON page 111)  3. breakpt() is not part of any ANSI C standard library. SAMPLE PROGRAM: /* breakpt example */ main() {  int i=0,j=10;  while(i
    						
    							  113  if() else  PURPOSE: Executes one statement when the specified condition is true (not zero). A second optional statement following the “else” is executed when the specified condition is false (0). FORMAT: if (condition) statement 1 else statement 2 PARAMETERS:  Condition can be any variable or expression that will be considered true if not 0. EXPLANATION: 1. The most simple conditional structure is: if (condition) statement. statement is executed only if condition is true (not 0) 2. You can add the else structure to process the case of condition being false (0). 3. Statement 1 and statement 2 can be if() then structure as well, allowing analyzing and processing multiple conditions. 4. The last else statement is often here to process unexpected entries or data configurations, for example generating an error warning. SAMPLE PROGRAM: /* if() else example */ /* upper case only! */ /* #include  */ main(){  char c;  c=getchar();  if ((c>=’A’)&&(c=’a’)&&(c
    						
    							  114  while()  PURPOSE: Executes repeatedly a statement as long as the specified condition is true (not zero). . FORMAT: while (condition) statement PARAMETERS:  Condition can be any variable or expression that will be considered true if not 0. EXPLANATION: 1. The “while” loop first executes the condition. If the condition is met (true, returning a value other than 0), the statement is executed, and execution loops back to the “while” loop to evaluate the condition again. 2. Whenever the condition is not met (false, returning 0), execution of the “while” loop is ended. SAMPLE PROGRAM: /* While example */ /* #include  */ main(){  char ch=’0’;  while (ch
    						
    							  115  for()  PURPOSE: Executes repeatedly a statement as long as the specified condition is true (not zero). FORMAT: for (expression 1; condition; expression 2) statement PARAMETERS:  1. expression 1 sets initial state. 2. condition allows the loop to repeat. 3. expression 2 is executed after the statement. EXPLANATION: 1. First, expression 1 is executed on first pass only (initialization). 2. Then, condition is evaluated. If true (not 0), the statement is executed. If false, loop ends. 3. After execution of the statement, expression 2 is executed, and execution loops back to condition evaluation. 4. Note that the any “for” loop could be written: for (expression 1; condition; {statement; expression 2}); Nevertheless, commonly accepted programming practice is to reserve the parenthesis after the “for” statement for loop control, putting all other statements after. SAMPLE PROGRAM: /* For example */ /* #include  */ main(){  char ch;  For (ch=’0’; ch
    						
    							  116  switch() case default  PURPOSE: executes various statements depending on the value of the parameter. FORMAT: switch (expression) { [case constant i: statement i ]; default: statement; }; PARAMETERS:  1. expression must be an integer type (char, int, long, signed or unsigned). 2. constant i (there is no limit to the number of “case: constant i” statements) is a constant from the same type as expression. EXPLANATION: 1. expression is evaluated, and compared to each constant. 2. If a constant matches the value of expression, the statements following the corresponding case are executed, until a “break” statement is found. 3. If no constant matches the value of expression, the statements following “default” are executed. 4. Note: In absence of a “break”, the execution of statements carries on. See the second sample program. SAMPLE PROGRAM: /* Switch break example */ /* #include  */ main(){  int a;  printf(“¥nEnter a value:”);  scanf(“%d”,&a);  switch(a){   case 1:    printf(“¥nThis is case 1”);    break;  case 2:   printf(“¥nThis is case 2”);   break;  case 3:   printf(“¥nThis is case 3”);   break;  default:printf(“¥nDefault case”);  } }  /* Switch w/o break example */ /* #include  */ main(){  int a;  printf(“¥nHow Many Players:”);  scanf(“%d”,&a);  switch(a){   case 4: Rst_Score(4);   case 3: Rst_Score(3);   case 2: Rst_Score(2);   case 1: Rst_Score(1); break;   default: printf(“¥nNot possible”);  } } SEE: if() else, break  
    						
    							  117  goto  PURPOSE: Branches unconditionally to a specified destination label. FORMAT: goto label; PARAMETERS: label is the name of a label defined within the same function. EXPLANATION: 1. the goto statement and label concept are similar to the ones used in BASIC. 2. a label is defined writing an identifier followed by a colon. 3. it is possible and recommended to avoid using the goto statement in a C program.  
    						
    							  118  6.3.1 Mathematical Functions The math functions are part of a standard library in ANSI C, and it is recommended to add the following comment at the beginning of your program: /* #include  */  abs()  PURPOSE: Returns the absolute value of an integer. FORMAT: int abs(n) int n;  angle()  PURPOSE: Specifies the unit of angular measurement. FORMAT: void angle(n) unsigned int n; PARAMETERS:  n = 0: unit = Degrees. n = 1: unit = Radians. n = 3: unit = Grads SEE: sin(), cos(), tan(), asin(), acos(), atan()  acos()  PURPOSE: Returns the angle value for which cosine (angle value) = parameter. FORMAT: double acos(x) double x; PARAMETERS:  x must be within the [-1, +1] range EXPLANATION: 1. The unit of the returned value is specified using the angle() function. 2. The returned value is in the [0 , 180°] or [0 , π Radians ] range. SEE: angle(), cos()  acosh()  PURPOSE: Returns the value for which hyperbolic cosine (value) = parameter. FORMAT: double acosh(x) double x; PARAMETERS:  x must be within the [1, 5x1099[ range EXPLANATION: 1. The mathematical formula for reverse hyperbolic cosine is: acosh(x) = ln ( x + √  ) where ln is the natural logarithm. 2. The returned value is in the [-230.2585092, +230.2585092] range. SEE: cosh(), log()  asin()  PURPOSE: Returns the angle value for which sine (angle value) = parameter. FORMAT: double asin(x) double x; PARAMETERS:  x must be within the [-1, +1] range EXPLANATION: 1. The unit of the returned value is specified using the angle() function. 2. The returned value is in the [-90°, 90°] or [ -π/2, π/2 Radians ] range. SEE: angle(), sin() x2 – 1  
    						
    							  119   asinh()  PURPOSE: Returns the value for which hyperbolic sine (value) = parameter. FORMAT: double asinh(x) double x; PARAMETERS:  x must be within the ]-5x1099, 5x1099[ range EXPLANATION: 1. The mathematical formula for reverse hyperbolic sine is: asinh(x) = ln ( x + √  ) where ln is the natural logarithm. 2. The returned value is in the [-230.2585092, +230.2585092] range. SEE: sinh(), log()  atan()  PURPOSE: Returns the angle value for which tangent (angle value) = parameter. FORMAT: double atan(x) double x; PARAMETERS:  x must be within the [-1x10100, +1x10100] range. EXPLANATION: 1. The unit of the returned value is specified using the angle() function. 2. The returned value is in the [-90°, 90°] or [ -π/2, π/2 Radians ] range. SEE: angle(), tan()  atanh()  PURPOSE: Returns the value for which hyperbolic tangent (value) = parameter. FORMAT: double atanh(x) double x; PARAMETERS:  x must be within the ]-1, +1[ range EXPLANATION: 1. The mathematical formula for reverse hyperbolic tangent is: atanh(x) = ( ln (1+x) – ln (1-x) ) / 2 where ln is the natural logarithm . 2. The returned value is in the ]-10100, +10100[ range. SEE: tanh(), log()  cos()  PURPOSE: Returns the value of cosine (parameter). FORMAT: double cos(x) double x; PARAMETERS:  x must be within the ]-1440°, +1440°[ or [-8π , 8π Radians ] range. EXPLANATION: 1. The unit of the parameter x is specified using the angle() function. 2. The returned value is in the [-1, 1] range. SEE: angle(), acos()  x2 + 1  
    						
    							  120  cosh()  PURPOSE: Returns the value of hyperbolic cosine (parameter). FORMAT: double cosh(x) double x; PARAMETERS:  x must be within the [-230.2585092, +230.2585092] range. EXPLANATION: 1. The mathematical formula for hyperbolic cosine is: cosh(x) = (ex + e-x) / 2 where e is 2.7182818284590452353602874713526... 2. The returned value is in the [-1, 5x1099[ range. SEE: acosh(), log()  exp()  PURPOSE: Returns the value of e(parameter). FORMAT: double exp(x) double x; PARAMETERS:  x must be within the [-230.2585092, +230.2585092] range. EXPLANATION: 1. The value of e is 2.7182818284590452353602874713526... 2. The returned value is in the ]0, 10100[ range. SEE: log()  log()  PURPOSE: Returns the natural logarithm of the parameter FORMAT: double log(x) double x; PARAMETERS:  x must be within the ]10-100, 10100[ range. EXPLANATION: 1. The returned value is in the [-230.2585092, +230.2585092] range. 2. log() is the inverse function of exp(): For any positive x, exp(log(x))#x. SEE: exp()  log10()  PURPOSE: Returns the common logarithm of the parameter FORMAT: double log10(x) double x; PARAMETERS:  x must be within the ]10-100, 10100[ range. EXPLANATION: The returned value is in the ]-100, +100[ range. SEE: log()   
    						
    All Casio manuals Comments (0)