Re: TIB: List-Q


[Prev][Next][Index][Thread]

Re: TIB: List-Q




I don't like to use if statements or multiple character variables unless
necessary, so see if this code helps you.

U = your money
I = your inventory, amount of each item you have
N = name of all items
P = prices for all items
T = type of items in shop
A = item number you want to purchase
B = 1 if you can/did buy the item
    0 if you can't/didn't buy the item

When buying, selecting item 0 will exit without buying.

:200/->/U
:9/->/dimL I
:Fill(0,I
:"Item AItem BItem CItem DItem EItem FItem GItem HItem I"/->/N
:{7,9,4,3,5,2,6,1,8/->/P
:Repeat A/>=/0 and A/<=/5
:ClLCD
:Disp "Welcome to Store","1:","2:","3:","4:","5:","Funds:"
:{1,3,6,7,9/->/T
:For(X,1,5
:Outpt(X+1,4,sub(N,6T(X)-5,6
:Outpt(X+1,12,P(X
:End
:Outpt(7,8,U
:Input "Pick an item: ",A
:End
:If A==0:Goto X
:1/->/B
:If 0/>=/U-P(A
:0/->/B
:B+I(T(A/->/I(T(A
:U-B*P(A/->/U
:Disp sub("Need more $Sold!",11B+1,5-6(B-1
:Lbl X


Sincerely,
The Unibomer

Jared Ivey
Unibomer@Juno.com
http://www.geocities.com/SiliconValley/Vista/7342

"Nothing succeeds like -- failure." -- Unknown


References: