This procedure uses the variable
an
swer
to store
the an swer typed by the
student. Because only this pro cedure needs to know about it, it can be de clared
in side the pro ce dure (
Dim an
swer
). Next, we use
InputBox
, just like in the
YourName
pro cedure, to ask the
student to type the an swer, which is stored in
the variable
an
swer
.
In
our multiple-choice ques tions, but tons were tied to our
RightAnswer
and
WrongAnswer
pro cedures. With a short-answer question, we don’t have
buttons
to call these pro cedures, so we use an
If
state ment. If the an swer is right,
call the ap
pro pri ate
RightAnswer
pro cedure; if the answer is wrong, call the
ap
pro pri ate
WrongAnswer
procedure.
The last thing you need is a way for the question to be asked. Fig ure 7.3
shows an ex
ample slide. Just con
nect the “Click to an
swer” but
ton to the
Do'stlaringiz bilan baham: