Skip to main content
Home▸ Forums▸ 68kMLA▸ Apple IIc programming confusion — #1
Post #1 by Apostrophe
Source Forum68kMLA
CategorySoftware
Post DateWed, 25 Feb 2009 - 00:20
Original URLhttps://68kmla.org/bb/threads/apple-iic-programming-confusion.16696/
Post
Hi,

If you haven't already seen my post in Conquests, one of the power supplies I ordered for my Apple IIc has just arrived, and I played with the IIc for about two hours. It works great! And I've been getting better at programming it.

But there's one thing I can't get it to do. I've mastered Graphics mode; I successfully plotted a smiley face (and altered its colors), I successfully got it to run number/variable related programs I write for it, I have more or less mastered commands like HOME, RUN, LIST, PRINT, INPUT, NEW, END, IF...THEN, GOTO, etc. But I can't get it to accept text answers.

If I write a program telling it to ask me the year, it works fine. For instance, here's the program I wrote, along with the result:

new

10 home

20 input "What year is it?";a

30 if a="2009" then goto 50

40 if a<>"2009" then goto 10

50 print "Correct!"

60 end

run

What year is it? 2009

Correct!

But I can't get it to do the same with words. For instance, I want it to ask for the state I live in (Ohio) and then ask for the month (February). But the result isn't quite as favorable. I've tried various combinations of string variable techniques as well, to no avail. Below is my program, along with the result:

new

10 home

20 input "What state do you live in?";a

30 if a="Ohio" then goto 50

40 if a<>"Ohio" then goto 10

50 input "Correct! Type 'next' for the next question.";b

60 if b="next" then goto 70

70 home

80 input "What month is this?";c

90 if c="February" then goto 110

100 if c<>"February" then goto 70

110 print "Correct! Thus concludes this program."

120 end

run

What state do you live in?Ohio

?REENTER

What state do you live in?OHIO

?REENTER

What state do you live in?"Ohio"

?REENTER

What state do you live in?Ohio$

?REENTER

What state do you live in?"Ohio$"

As you can see, I've tried various combinations of Ohio, all with no results. And sometimes, it does this:

...

...

110 print "Correct! Thus concludes this program."

120 end

run

?SYNTAX ERROR IN 3

And so I'd type LIST 30, but the line looks just as I typed it, with no obvious mistakes.

So then I'd try to skip it. I'd type RUN 70, and it asks the question at 70, but never accepts my answer as the correct one, saying ?REENTER What month is this? over and over and over again, no matter what I type in.

Is there something I'm missing? Anything I'm not doing quite right?

-Apostrophe

mp.ls