Here is the problem:
Write a Visual Basic Console Application which executes a Do-While loop repetitively. Each time the Do-While loop executes input a String value, count and display the number of occurrences of the letters a, b, c, d and e. Use at least one Select Case statement inside your Do-While loop. For example, suppose during one execution of the Do-While loop you input the following String value: My mother is a great lady!. Your program should input this value into a String variable, compute the number of times each of the letters a, b, c, d and e occurs and output the results: a 3, b 0, c 0, d 1, and e 2. Terminate your Do-While loop once a value of All Done! is entered for the String value.
Here is my code:
Dim s1 As String Dim a, b, c, d, e, count As Integer Do While (s1 <> "all done") Console.WriteLine("Please enter a sentence") Select Case s1.Chars(count) Case "a" a = a + 1 Case "b" b = b + 1 Case "c" c = c + 1 Case "d" d = d + 1 Case "e" e = e + 1 End Select Console.WriteLine("A = " & a & vbNewLine & "B = " & b & vbNewLine & "C = " & c & vbNewLine & "D = " & d & vbNewLine & "E = " & e) Loop
This post has been edited by Jer5078: 04 November 2009 - 01:14 PM