This is the revision of the very first program that I have ever made. I think it is the only complete program that I ever made. I have been learning DBPro ever since. When I start one project, I learned one thing, and found that I couldnt' continue, so I start a new project. When I get to the same point that I got at the first project, I found that what I learned from the second project will help me with the first. Here's the original code:
dim number_group$(6)
number_group$(1)="1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33 35 37 39 41 43 45 47 49 51 53 55 57 59 61 63"
number_group$(2)="2 3 6 7 10 11 14 15 18 19 22 23 26 27 30 31 34 35 38 39 42 43 46 47 50 51 54 55 58 59 62 63"
number_group$(3)="4 5 6 7 12 13 14 15 20 21 22 23 28 29 30 31 36 37 38 39 44 45 46 47 52 53 54 55 60 61 62 63"
number_group$(4)="8 9 10 11 12 13 14 15 24 25 26 27 28 29 30 31 40 41 42 43 44 45 46 47 56 57 58 59 60 61 62 63"
number_group$(5)="16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63"
number_group$(6)="32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63"
total = 0
print "Think of a number 1 - 63. If the number appears in the group of numbers, press y and enter. If the number does not appear, then press n and enter."
Wait 5000
print " "
print number_group$(1)
Wait 1000
print "Is it here? (y)es or (n)o?"
input a$
print " "
REM if y is entered, then 1 is added to the total, if n is entered, then 0 is added to total
if a$ = "y"
total = total + 1
else
total = total + 0
endif
REM next group
print " "
print number_group$(2)
wait 1000
print "Is it here? (y)es or (n)o?"
input a$
REM if y is entered, then 2 is added to the total, if n is entered, then 0 is added to total
if a$ = "y"
total = total + 2
else
total = total + 0
endif
print " "
REM next group
print number_group$(3)
wait 1000
print "Is it here? (y)es or (n)o?"
input a$
REM if y is entered, then 4 is added to the total, if n is entered, then 0 is added to total
if a$ = "y"
total = total + 4
else
total = total + 0
endif
REM next group
print " "
print number_group$(4)
wait 1000
print "Is it here? (y)es or (n)o?"
input a$
REM if y is entered, then 8 is added to the total, if n is entered, then 0 is added to total
if a$ = "y"
total = total + 8
else
total = total + 0
endif
REM next group
print " "
print number_group$(5)
wait 1000
print "Is it here? (y)es or (n)o?"
input a$
REM if y is entered, then 16 is added to the total, if n is entered, then 0 is added to total
if a$ = "y"
total = total + 16
else
total = total + 0
endif
REM next group
print " "
print number_group$(6)
wait 1000
print "Is it here? (y)es or (n)o?"
input a$
REM if y is entered, then 32 is added to the total, if n is entered, then 0 is added to total
if a$ = "y"
total = total + 32
else
total = total + 0
endif
CLS
REM the sum is calculated and printed to the screen
print "Your number is "; total
Wait Key
End
function SetOperation()
select Operation
case 1
total = total + 1
endcase
case 2
total = total + 2
endcase
case 3
total = total + 4
endcase
case 4
total = total + 8
endcase
case 5
total = total + 16
endcase
case 6
total = total + 32
endcase
endselect
endfunction
this is my revision and my 20-line entry:
`pick a number 1 - 63
dim number_group$(6)
number_group$(1)="1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33 35 37 39 41 43 45 47 49 51 53 55 57 59 61 63"
number_group$(2)="2 3 6 7 10 11 14 15 18 19 22 23 26 27 30 31 34 35 38 39 42 43 46 47 50 51 54 55 58 59 62 63"
number_group$(3)="4 5 6 7 12 13 14 15 20 21 22 23 28 29 30 31 36 37 38 39 44 45 46 47 52 53 54 55 60 61 62 63"
number_group$(4)="8 9 10 11 12 13 14 15 24 25 26 27 28 29 30 31 40 41 42 43 44 45 46 47 56 57 58 59 60 61 62 63"
number_group$(5)="16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63"
number_group$(6)="32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63"
total = 0
x# = .5
for n = 1 to 6
x# = x#*(2)
print number_group$(n)
print "Is it here? (y)es or (n)o?"
input a$
if a$ = "n" then total = total + 0
if a$ = "y" then total = total + x#
next n
print "Your number is "; total
Wait Key