added a couple more exercises
This commit is contained in:
parent
e657af0635
commit
dc1c84da4d
40
qb64/cascading-numbers.bas
Normal file
40
qb64/cascading-numbers.bas
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
REM Cascading numbers
|
||||||
|
REM by John Paul Wohlscheid
|
||||||
|
|
||||||
|
REM ask for numbers
|
||||||
|
PRINT "Please enter four numbers and watch the values cacade"
|
||||||
|
INPUT "Enter your first number: "; num1%
|
||||||
|
INPUT "Enter your second number: "; num2%
|
||||||
|
INPUT "Enter your third number: "; num3%
|
||||||
|
INPUT "Enter your fourth number: "; num4%
|
||||||
|
|
||||||
|
ab% = num1% - num2%
|
||||||
|
cd% = num3% - num4%
|
||||||
|
finalnum% = ab% - cd%
|
||||||
|
|
||||||
|
REM displaying numbers while using str$ to convert numbers to strings
|
||||||
|
CLS
|
||||||
|
PRINT STR$(num1%) + " " + STR$(num2%) + " " + STR$(num3%) + " " + STR$(num4%)
|
||||||
|
PRINT " \ / \ /"
|
||||||
|
PRINT " \ / \ /"
|
||||||
|
PRINT " \ / \ /"
|
||||||
|
PRINT " \ / \ /"
|
||||||
|
PRINT " \ / \ /"
|
||||||
|
PRINT
|
||||||
|
print " " + STR$(ab%) + " " + STR$(cd%)
|
||||||
|
PRINT
|
||||||
|
print " \ /"
|
||||||
|
PRINT " \ /"
|
||||||
|
print " \ /"
|
||||||
|
print " \ /"
|
||||||
|
PRINT " \ /"
|
||||||
|
PRINT " \ /"
|
||||||
|
PRINT " \ /"
|
||||||
|
print " \ /"
|
||||||
|
PRINT " \ /"
|
||||||
|
PRINT " \ /"
|
||||||
|
PRINT " \ /"
|
||||||
|
print " \/"
|
||||||
|
PRINT
|
||||||
|
print " " + STR$(finalnum%)
|
||||||
|
PRINT "=========================================================="
|
29
qb64/cascading-numbers2.bas
Normal file
29
qb64/cascading-numbers2.bas
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
REM Cascading numbers 2.0
|
||||||
|
REM by John Paul Wohlscheid
|
||||||
|
|
||||||
|
REM ask for numbers
|
||||||
|
PRINT "Please enter twn numbers and watch the values cacade"
|
||||||
|
INPUT "Enter your first number: "; num1%
|
||||||
|
INPUT "Enter your second number: "; num2%
|
||||||
|
INPUT "Enter your third number: "; num3%
|
||||||
|
INPUT "Enter your fourth number: "; num4%
|
||||||
|
INPUT "Enter your fifth number: "; num5%
|
||||||
|
INPUT "Enter your sixth number: "; num6%
|
||||||
|
INPUT "Enter your seventh number: "; num7%
|
||||||
|
input "Enter your eighth number: "; num8%
|
||||||
|
INPUT "Enter your ninth number: "; num9%
|
||||||
|
INPUT "Enter your tenth number: "; num10%
|
||||||
|
|
||||||
|
ab% = num1% - num2%
|
||||||
|
cd% = num3% - num4%
|
||||||
|
ef% = num5% - num6%
|
||||||
|
gh% = num7% - num8%
|
||||||
|
ij% = num9% - num10%
|
||||||
|
finalnum% = ab% - cd%
|
||||||
|
|
||||||
|
REM displaying numbers while using str$ to convert numbers to strings
|
||||||
|
CLS
|
||||||
|
PRINT STR$(num1%) + " " + STR$(num2%) + " " + STR$(num3%) + " " + STR$(num4%) + " " + STR$(num5%) + " " + STR$(num6%)
|
||||||
|
|
||||||
|
|
||||||
|
PRINT "=========================================================="
|
39
qb64/social-security.bas
Normal file
39
qb64/social-security.bas
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
start:
|
||||||
|
CLS
|
||||||
|
PRINT "This program will help you determine"
|
||||||
|
PRINT "if you are old enough to apply for"
|
||||||
|
PRINT "Social Security."
|
||||||
|
PRINT
|
||||||
|
INPUT "Please enter your current age."; age
|
||||||
|
IF age < 65 THEN GOSUB young:
|
||||||
|
IF age > 65 THEN GOSUB old:
|
||||||
|
IF age = 65 THEN GOSUB correct:
|
||||||
|
GOTO start
|
||||||
|
|
||||||
|
young:
|
||||||
|
CLS
|
||||||
|
PRINT "You are too young. Please try again"
|
||||||
|
PRINT "in a couple of years."
|
||||||
|
PRINT
|
||||||
|
INPUT "Press 'Enter' to continue."; dummyVariable
|
||||||
|
PRINT
|
||||||
|
GOTO start
|
||||||
|
|
||||||
|
old:
|
||||||
|
CLS
|
||||||
|
PRINT "You are should have applied for"
|
||||||
|
PRINT "Social Security by now."
|
||||||
|
PRINT
|
||||||
|
INPUT "Press 'Enter' to continue."; dummyVariable
|
||||||
|
PRINT
|
||||||
|
GOTO start
|
||||||
|
|
||||||
|
correct:
|
||||||
|
CLS
|
||||||
|
PRINT "You are now eligiable to apply for "
|
||||||
|
PRINT "Social Security."
|
||||||
|
PRINT
|
||||||
|
INPUT "Press 'Enter' to continue."; dummyVariable
|
||||||
|
PRINT
|
||||||
|
GOTO start
|
||||||
|
|
11
red/ask-age.red
Normal file
11
red/ask-age.red
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
Red [needs: view]
|
||||||
|
view [
|
||||||
|
f1: field "First name"
|
||||||
|
f2: field "Last name"
|
||||||
|
button "Greet me!" [
|
||||||
|
t1/text: rejoin ["Have a nice day " f1/text " " f2/text "!"]
|
||||||
|
]
|
||||||
|
return
|
||||||
|
t1: text "" 200
|
||||||
|
|
||||||
|
]
|
Loading…
Reference in New Issue
Block a user