通过教程,但我无法弄清楚如何做到这一点。它希望我让程序显示之前在quit
sub之后输入的所有10个名称。我已经尝试了一些东西,但无法弄清楚如何做到这一点。
'ARRAYS.BAS
'List handling with arrays
dim names$(10) 'set up our array to contain 10 items
[askForName] 'ask for a name
input "Please give me your name ?"; yourName$
if yourName$ = "" then print "No name entered." : goto [quit]
index = 0
[insertLoop]
'check to see if index points to an unused item in the array
if names$(index) = "" then names$(index) = yourName$ : goto [nameAdded]
index = index + 1 'add 1 to index
if index < 10 then [insertLoop] 'loop back until we have counted to 10
'There weren't any available slots, inform user
print "All ten name slots already used!"
goto [quit]
[nameAdded] 'Notify the name add was successful
print yourName$; " has been added to the list."
goto [askForName]
[quit]
end
答案 0 :(得分:0)
在[quit]
和end
之间插入此代码:
for I = 0 TO 10
print names$(I)
next I
该工作;)