Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Collection of Basic Computer Games
#6
Here's an Update for Change:
Code: (Select All)
_Title "Change Update" ' b+ 2024-07-21
Dim a&(1 To 10), s$(1 To 10)
a&(1) = 5000: a&(2) = 2000: a&(3) = 1000: a&(4) = 500: a&(5) = 100
a&(6) = 50: a&(7) = 25: a&(8) = 10: a&(9) = 5: a&(10) = 1
s$(1) = "$50 bills": s$(2) = "$20 bills": s$(3) = "$10 bills": s$(4) = "$5 bills": s$(5) = "$1 bills"
s$(6) = "half dollars": s$(7) = "quarters": s$(8) = "dimes": s$(9) = "nickels": s$(10) = "pennies"
restart:
Print: Input "Enter amount to collect up to 100.00 (0 to quit)"; collect
If collect <= 0 Or collect > 100 Then End
Input "Enter amount paid "; paid
change = paid - collect
If change < 0 Then Print "You did not pay enough.": GoTo restart
If change = 0 Then Print "Thank you come again.": GoTo restart
c& = change * 100
For i = 1 To 10
    amt& = Int(c& / a&(i)): TotChange = TotChange + amt& * a&(i)
    If amt& Then c& = c& - amt& * a&(i): Print amt&; " "; s$(i)
Next
GoTo restart
b = b + ...
Reply


Messages In This Thread
Collection of Basic Computer Games - by eoredson - 06-16-2024, 03:03 AM
RE: Collection of Basic Computer Games - by bplus - 06-16-2024, 01:23 PM
RE: Collection of Basic Computer Games - by bplus - 07-21-2024, 07:19 PM
RE: Collection of Basic Computer Games - by bplus - 07-21-2024, 11:28 PM
RE: Collection of Basic Computer Games - by bplus - 07-22-2024, 05:41 PM
RE: Collection of Basic Computer Games - by bplus - 07-22-2024, 06:54 PM



Users browsing this thread: 5 Guest(s)