Traversing a String and Counting Instances of a Character

Traversing a String and Counting Instances of a Character

This program uses array notation to traverse a string. It accepts a letter and a phrase from the user, then counts and returns the number of times that letter is found in the phrase. It differentiates between upper and lower case, so will only return the count of whichever case is entered. This could be easily modified to return a total count of both cases.

Leave a Reply

Your email address will not be published. Required fields are marked *