Commodore 64 User Manual page 112

Hide thumbs Also See for 64:
Table of Contents

Advertisement

The array table for this problem could be represented like this:
YES
QUESTION 1
QUESTION 2
QUESTION 3
QUESTION 4
RESPONSES
NO
UNDECIDED
The program to do the actual tabulation for the questionnaire might
look like that shown on page 103.
This program makes use of many of the programming techniques that
have been presented so far. Even if you don't have any need for the
actual program right now, see if you can follow how the program
works.
The heart of this program is a 4 by 3 two-dimensional array, A(4,3).
The total responses for each possible answer to each question are held
in the appropriate element of the array. For the sake of simplicity, we
don't use the first rows and column (A(0,0) to A(0,4)). Remember,
though, that those elements are always present in any array you design.
In practice, if question one is answered YES, then A(1,1) is in-
cremented by one-row 1 for question 1 and column 1 for a YES re-
sponse. The rest of the questions and answers follow the same pattern.
A NO response for question three would add one to element A(3,2), and
so on.
e
do.
102
0

Hide quick links:

Advertisement

Table of Contents
loading

Related Products for Commodore 64

Table of Contents