1
<HTML><HEAD><TITLE>Answer to Exercise 73</TITLE></HEAD>
2
<BODY BGCOLOR="#FFFFFF">
3
<TABLE><TR><TD Valign="top"><IMG SRC="../icons/exercise.gif" ALT="??"><TD bgcolor="#FAA89B"><B>ANSWER TO EXERCISE 73</B><TR><TD><TD>
6
Here goes: we could implement the buttons with five
7
separate objects, essentially duplicates of each other. (And by using a
8
class definition, this wouldn't look too bad.) But if there were
9
500 slides this would be less reasonable.
12
if (location~=Machine_Room) return -1;
13
w=NextWord(); if (w=='slide') w=NextWord();
15
{ 'first', 'one': n=1;
17
'third', 'three': n=3;
18
'fourth', 'four': n=4;
20
default: return -1; ! Failure!
22
w=NextWord(); if (w~='slide') wn--; ! (Leaving word counter at the
23
! first misunderstood word)
27
Global slide_settings --> 5; ! A five-word array
29
slide_settings-->(noun-1) = second;
30
print_ret "You set slide ", (number) noun,
31
" to the value ", second, ".";
34
print_ret "Slide ", (number) noun, " currently stands at ",
35
slide_settings-->(noun-1), ".";
38
* ASlide "to" number -> SetSlide;
40
* ASlide "to" number -> SetSlide;
41
Extend "examine" first
42
* ASlide -> XSlide;
46
<HR>Back to <A HREF="../section27.html#ex73">the exercise in section 27</A><HR>
47
<SMALL><I>Mechanically translated to HTML from third edition as revised 16 May 1997. Copyright © Graham Nelson 1993, 1994, 1995, 1996, 1997: all rights reserved.</I></SMALL></BODY></HTML>