To my surprise, I was thumbing through my old printouts and discover that I actually wrote an Input Two program. I covered Input One as Marchís Program of the Month. For September, however, it is Input Twoís opportunity to shine.
Input Two is a very different program though. Unlike the first program that was a study in guessing words, the second is a work of text manipulation. It takes the words you entered and reverses them. Much like before, Input Two does this using brute force. It isn't†elegant, but it works and the program displays the results†rather nicely.
So how does it work? Simply, it uses a pair of
FOR loops. The first one walks the list of words. The second one flips the word. Nothing special, but I did something in this program I donít remember doing before. I used a three-dimensional array. In case you missed it, here is the line of code:
10 DIM A$(10,2,10)
Iíve used plenty of two-dimensional arrays, usually to represent a series of words. But three is pretty rare, at least for me.
So why three? The first dimension is the number of words. In this case there are ten words or 10. Since I want to flip the word, the second dimension represents the word forward, 1, and backward, 2.† The last dimension is the size of the word. I chose a pretty good size of 10. It actually works quite nicely since it is what helps create the uniform display. However, it does mean longer words will get truncated.
Speaking of the display, I did notice something odd when using long words. If you use exactly ten letters, you will notice them butting up against each other. I probably should have included a space between them. But it doesnít really matter much.
Input Two does a good job of showcasing doing something with entered words. I will note, however, that I donít miss those
INPUT statements. Although they work, it breaks up the flow. The way the ZX81 dumps you to the bottom of the screen is just odd and something I really donít miss.