TERMINAL - newbie question
07-26-2015, 06:02 PM (This post was last modified: 07-26-2015 06:02 PM by smp.)
Post: #1
 smp Senior Member Posts: 463 Joined: Jul 2015
TERMINAL - newbie question
I am on my third day with my new Prime, and I'm loving it.

To try out PPL for the first time, I entered one of my favorite programs - how many ways to make \$1.00 from change. It's a simple set of four nested FOR-NEXT statements with a test in the middle for whether or not the current combination of pennies, nickels, dimes and quarters add up to 100.

In the middle, I like to also print out those combinations that add up to 100. Usually, something like this: P: w N: x D: y Q: z all on one line for each combination.

I have learned that the PRINT command will output to a screen called Terminal. It seems that Terminal is only available while the program is making output to it. I cannot find any other way to view it.

Here's my program (with thanks to DrD for his previous help):

Code:
EXPORT Dollar() BEGIN PRINT(); C:=0; FOR P FROM 0 TO 100 STEP 5 DO   FOR N FROM 0 TO 20 DO     FOR D FROM 0 TO 10 DO       FOR Q FROM 0 TO 4 DO         IF P+(N*5)+(D*10)+(Q*25)=100 THEN C:=C+1;           PRINT("P:" +P +"  " +"N:" +N +"  " +"D:" +D +"  " +"Q:" +Q);         END;       END;     END;   END; END; WAIT(-1); RETURN MSGBOX(C +" ways_to_make_a_dollar"); END;

When this program runs, I see the Terminal screen and it quickly fills with lines of output, then appears to stop. After a few seconds, it starts scrolling as more lines of output are printed. After the end of the lines that start with P:30 (30 pennies) or thereabouts, the scrolling stops again and nothing more happens.

I believe at this point, the program has already finished, because a tap on the screen will immediately bring me back to the Program Catalog screen (that's where I started the program from) and display the MSGBOX. If I invoke my program from the Home screen, the same thing happens with seeing the Terminal screen, and then a tap brings me back to the Home screen with the MSGBOX and the indication that the program ran successfully.

My question is this: How come I never see all 242 lines of output on the Terminal screen, and the output stops part way through? Is it because the calculator completes all the looping and calculating before it has time to get all the PRINT statements out to the Terminal screen?

Thanks very much, again, for your patience and advice.

smp
07-26-2015, 06:32 PM
Post: #2
 eried Senior Member Posts: 744 Joined: Dec 2013
RE: TERMINAL - newbie question
If you remove the

Code:
WAIT(-1); RETURN MSGBOX(C +" ways_to_make_a_dollar");

the terminal will stay visible until you exit it with ON. If you place your cursor over a PRINT command and press HELP button you will see the on-line help that tells you that pressing ON+T you can launch the terminal again.

My website: erwin.ried.cl
07-26-2015, 07:02 PM
Post: #3
 smp Senior Member Posts: 463 Joined: Jul 2015
RE: TERMINAL - newbie question
Thanks very much, eried! Your assistance is greatly appreciated.

smp
 « Next Oldest | Next Newest »

User(s) browsing this thread: 1 Guest(s)