Decode_char function
/* This function expects a character (color code) and returns a double precision floating-point number as its value. If the code is not legal, it returns a value that signals that fact. */
double decode_char(char code)
{
switch (code) {
case 'B':
return 0.0;
case 'N':
return 1.0;
case 'R':
return 2.0;
case 'O':
return 3.0;
case 'Y':
return 4.0;
case 'G':
return 5.0;
case 'E':
return 6.0;
case 'V':
return 7.0;
case 'A':
return 8.0;
case 'W':
return 9.0;
default:
return -999.0;
}
}
Previous slide
Next slide
Back to first slide
View graphic version