Why are you 'totally lost'?
As already suggested, the trick is accessing the
string
as an array of characters (string provides the
[]
operator for the purpose), so your algorithm would be, basically:
- Reset vowel counters (
aCt=0
; ...). - Reset index (say
n=0
). - if
n>=length
of the string then exit. - if character at index
n
, namely str[n]
is 'a'
then increment aCt
else if it is 'e'
then increment eCt
else if ... - increment index
n
. - go to point 3.
Would you like some fries too?
:-)