Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
coins
#1
i am supposed to make a program that give option of searching for coins or sorting them in alphabetical order i don't know what is wrong with this program any ideas? or sugeestions would be helpful :rotfl:

Code:
CLS
OPTION BASE 1
DIM coin$(10), prices(10)
CLS
GOSUB setup
GOSUB menu
GOSUB process
GOSUB shellsort
GOSUB prints
GOSUB wrapup
END
setup:
h1$ = "coin              price"
h2$ = "----              -----"
p1$ = "\                \#####"
RETURN
menu:                              
PRINT "                               Û±ÛÛ°Û±Û±Û"
PRINT "                               °Û MENU Û°"
PRINT "                               Û±ÛÛ°Û±Û±Û"
'FOR x = 100 TO 500 STEP 25
'SOUND x, 2
'SOUND 600 - x, 2
'NEXT x
PRINT "1) Sort"
PRINT "2) Search"
PRINT "3) End"
INPUT "choose an option===>"; menu
SELECT CASE menu
CASE 1
GOSUB shellsort
CASE 2
GOSUB processreport
CASE 3
END
CASE ELSE
PRINT "Invalid"
SLEEP 1
SLEEP 1
GOSUB menu
END SELECT
RETURN
process:
OPEN "coin.dat" FOR INPUT AS #1
FOR x = 1 TO 10
INPUT #1, coin$(x), prices(x)
NEXT x
CLOSE
RETURN
shellsort:
gap = number / 2
DO WHILE gap > 0
limit = number
switch$ = "on"
DO WHILE switch$ = "on"
switch$ = "off"
FOR i = 1 TO limit - gap
IF coin$(i) > coin$(i + gap) THEN
SWAP coin$(i), coin$(i + gap)
SWAP prices(i), prices(i + gap)
switch$ = "on"
last = i
END IF
NEXT i
limit = last
LOOP
gap = gap / 2
LOOP
RETURN

prints:
PRINT h1$
PRINT h2$
FOR x = 1 TO 10
PRINT USING p1$; coin$(x); prices(x)
total = total + prices(x)
NEXT x
RETURN
wrapup:
PRINT
PRINT USING p1$; "total = "; total
RETURN


processreport:
'DO
'GOSUB acceptoperator.input
'GOSUB accesstable.function
'LOOP UNTIL UCASE$(control$) = "N"
'GOSUB menu
'acceptoperator.input:
'CLS
'LOCATE 5, 15
'INPUT "Coin Name"; searcharguement
'GOSUB accesstable.function
'accesstable.function:
CLS
DO
FOR x = 1 TO 10
row% = CSRLIN
col% = POS(0)
coin$(x) = coin$(x) + w$
w$ = INPUT$(1)
IF w$ = CHR$(13) THEN EXIT DO
IF w$ = CHR$(8) THEN
IF NOT coin$(x) = "" AND NOT col% = 1 THEN
coin$(x) = MID$(coin$(x), 1, LEN(coin$(x)) - 1)
w$ = " "
LOCATE row%, (col% - 1): PRINT " ";
LOCATE row%, (col% - 1)
ELSE
w$ = ""
END IF
ELSE
PRINT "*";
END IF
PRINT coin$(x)
LOOP
PRINT
NEXT x
'FOR prices = 1 TO 10
'IF searcharguement$ = coin$ THEN
'EXIT FOR
'END IF
'NEXT prices
'IF number <= x THEN
'GOSUB displaytable.function
'ELSE
'LOCATE 7.15
'PRINT "Coin Name"; searcharguement; "Not Found"
'END IF
'LOCATE 11, 15
'INPUT "enter y to look up another Coin else n"; control$
'GOSUB displaytable.function
'displaytable.function:
'LOCATE 7, 15
'PRINT "Coin====>"; coin$(x)
'LOCATE 11, 15
'p1$ = "price===>####"
'PRINT USING p1$; price(x)
'GOSUB menu

my data file
Code:
"Super Nickle",14.25
"DoubleSided Quarter",10.50
"Europe's Currency",0.00
"Olympics Dime",5.00
"Random Penny",0.01
"Gold Quarter",10.00
"Victorian Pound",1.55
"Confederate Coin",1.00
"New Year Coin",5.00
"Birthday Coin",5.00[/code]
Reply


Messages In This Thread
coins - by logicalaxiom - 05-16-2005, 07:32 PM
coins - by Moneo - 05-20-2005, 06:16 AM
coins - by logicalaxiom - 05-24-2005, 04:40 AM
coins - by Moneo - 05-24-2005, 04:50 AM
coins - by Ralph - 05-24-2005, 10:33 PM
coins - by Moneo - 05-25-2005, 04:03 AM
coins - by logicalaxiom - 05-25-2005, 06:57 AM
coins - by SJ Zero - 05-25-2005, 09:50 AM
coins - by Moneo - 05-26-2005, 04:32 AM
coins - by Moneo - 05-26-2005, 05:12 AM
coins - by Pyrokid - 05-30-2005, 06:07 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)