hi i need some help with a project. the projects want me to use delegates to allow the user to enter words and display the words in a reverse order, how many words were entered, and the number of letters there were.
as u can see from the code i put at the bottom, all i need to do is have it display the number of letters but i dont know how do to that. i do not need you to give me the code it self but just give the the sintax to do it. just to tell you a little about the program, i used a stack to do eveything
plz only post real answers
NOTE: im useing VB.net
here is the program
Imports System
Imports System.Collections
Imports System.Delegate
Module Module1
Dim words As New Stack
Public Delegate Sub mydelegate()
Dim w As String
Public Sub Main()
Dim fns As mydelegate
fns = (AddressOf definingstack)
fns()
fns = (AddressOf revewstack)
fns()
End Sub
Public Sub definingstack()
Console.WriteLine("please enter a letter/word to put in the stack and enter a blank line to continue")
Console.WriteLine("to exit the loop, type in 'stop' and press enter (remember the keyword 'stop' will be included in the stack)")
Do Until w = "stop"
Try
w = Console.ReadLine()
words.Push(w)
Catch ex As StackOverflowException
Console.WriteLine("you put to many words in the stack, please start the program over and dont go over your word limit")
End Try
Loop
Console.WriteLine("press enter to move to the next part")
Console.ReadLine()
End Sub
Public Sub revewstack()
Console.WriteLine("the number of words in the stack is : " & words.Count)
While words.Count > 0
Console.WriteLine(words.Pop)
End While
Console.WriteLine("press enter to leave the program")
Console.ReadLine()
End Sub
End Module