Monday, July 27, 2009

Source code of a program in c++(show first two vowels and hide 2nd two vowels)?

for example


user enter


input





wasim is a good boy . He goes to school.





output





wasim -s - good b-y . H- goes t- sch-ol.

Source code of a program in c++(show first two vowels and hide 2nd two vowels)?
i think there is mistake in your question. Wil the last vowel be shown always. Please post a proper question with a straight output.
Reply:It looks like that it alternates between 2 shown vowels and 2 hidden vowels.





I'd have 2 variables to control :





a) Am I showing or hiding the next vowel, and


b) How many vowels are hidden/shown





Then have a loop to traverse the string, checking each character such that:





if is_vowel


__hide vowel by setting that character to dash if needed


__increment counter


__if counter = 2


____reset counter


____flip next vowel to hide/show as needed


No comments:

Post a Comment