Friday, October 28, 2016

3. Programming practice for 9608 ( paper 2)

Computer Science(9608) notes and Resources

           



                                             



Module Module1
  
    Sub main()

        Dim text, tempText, temp As String
        Dim count, counter As Integer

        Console.Write("Enter any word: ")
        text = Console.ReadLine() 
        text = LCASE(text)
               
        tempText = ""

        Do
            temp = Mid(text, 1, 1)
            For counter = 1 To Len(text)
                If temp = Mid(text, counter, 1) Then
                    count = count + 1
                Else
                    tempText = tempText + Mid(text, counter, 1)
                End If
            Next
            Console.WriteLine(temp & " = " & count)
            count = 0
            text = tempText
            tempText = ""

        Loop Until Len(text) = 0
  
      Console.ReadLine()

    End Sub


 End Module

                                                                              - CIE A-LEVEL COMPUTER SCIENCE (  9608 )

No comments:

Post a Comment

Comments here....