12-16-2022, 07:06 PM
(This post was last modified: 12-16-2022, 07:07 PM by James D Jarvis.)
this program was generated by chat gpt. I did have to lightly edit it because it tried to use the symbol "&" in place of the symbol ";" in print commands, otherwise it all came from this prompt:
create qb64pe source code that allows the user to select from a displayed list of 10 entries.
create qb64pe source code that allows the user to select from a displayed list of 10 entries.
Code: (Select All)
' Define an array to hold the list of entries
Dim entries(10) As String
' Populate the array with sample data
entries(1) = "Apple"
entries(2) = "Banana"
entries(3) = "Cherry"
entries(4) = "Date"
entries(5) = "Eggplant"
entries(6) = "Fig"
entries(7) = "Grape"
entries(8) = "Honeydew"
entries(9) = "Kiwi"
entries(10) = "Lemon"
' Display the list of entries
Print "Please select an entry from the list:"
For i = 1 To 10
Print i; ") "; entries(i)
Next i
' Get the user's selection
Do
Input "Enter your selection: ", selection
If selection < 1 Or selection > 10 Then
Print "Invalid selection. Please try again."
Else
Exit Do
End If
Loop
' Display the selected entry
Print "You selected: "; entries(selection)