Hi,
I'm somewhat new to programming so I'm just doing little questions I find on this internet, this one is working with arrays etc and I have looked at tutorials however I still can't manage to work this out:
Construct a program which asks a user for a sweet name. Search for it in the array. Display the position in the array. If the sweet is not found, it should display a message saying so. Test your program with sweets which exist within it and sweets who do not. Use a function to search.
Any help would be much appriciated.
Thanks a lot!
I'm somewhat new to programming so I'm just doing little questions I find on this internet, this one is working with arrays etc and I have looked at tutorials however I still can't manage to work this out:
Construct a program which asks a user for a sweet name. Search for it in the array. Display the position in the array. If the sweet is not found, it should display a message saying so. Test your program with sweets which exist within it and sweets who do not. Use a function to search.
Code:
Module Module1
Sub Main()
Dim arrSweets(5)
arrSweets(0) = "Mars"
arrSweets(1) = "Skittles"
arrSweets(2) = "Galaxy"
arrSweets(3) = "Starburst"
arrSweets(4) = "Malteasers"
arrSweets(5) = "Twirl"
Console.WriteLine("Search For A Sweet")
Dim Search As String = Console.ReadLine()
Console.ReadLine()
End Sub
End Module
Thanks a lot!