Phonetics 5000 Manuale Utente

Pagina di 143
80
Sensaphone
®
 ISACC Instruction Manual
In many of the examples in this chapter, we use x and y as variable names.  The variable name
can be up to 15 characters long.  Numbers can also be used as long as the name does not
begin with a number.  In addition to letters and numbers, the underscore character may be
used in a variable name, but it cannot be the first character of the variable name.
The following are valid variable names:
int average;
int outside_temp;
int condition1;
int contact12;
The following are NOT valid variable names:
int 3temp;
int average_result_per_day;
int inside room;
int _timer;
4.  The ISACC C language has other tools available to construct your program.  One of the
most important tools is the “if ” statement.  The “if ” statement is used to make a decision
whether or not to execute a sequence of statements.
Example:
 The following program will print “X is big” only if x if greater than 10, which in
this case is true.  When the condition in the “if ” statement is true, the program continues
through the statements inside the “if ” braces.  If the condition was not true, the program skips
the block of statements.
int x;
main()
  {
  x=14;
  if (x>10)
    {
    puts(“X is big\n”);
    }
  }
The “else” statement can be used with the “if ” statement and gives instructions on what to do
when the "if" statement is false.