-8

At the moment I have figured out how to make every vowel into a '!' and it does work. I have used a bool isVowel() function for that.

Now I want to uppercase every third letter. My array is char aPhrase[15] = "strongpassword":

while (aPhrase[i])
{
c=aPhrase[i];
putchar(toupper(c));
i+=3;
}

This just gets me SOPSRR instead of Str!ngP!sSw!Rd.

Remy Lebeau
  • 555,201
  • 31
  • 458
  • 770
  • 3
    Please show a [mcve], and explain specifically where you're stuck in your code. – πάντα ῥεῖ Nov 18 '18 at 19:17
  • 1
    Welcome to stackoverflow.com. Please take some time to read [the help pages](http://stackoverflow.com/help), especially the sections named ["What topics can I ask about here?"](http://stackoverflow.com/help/on-topic) and ["What types of questions should I avoid asking?"](http://stackoverflow.com/help/dont-ask). Also please [take the tour](http://stackoverflow.com/tour) and [read about how to ask good questions](http://stackoverflow.com/help/how-to-ask). Lastly please read [this question checklist](https://codeblog.jonskeet.uk/2012/11/24/stack-overflow-question-checklist/). – Some programmer dude Nov 18 '18 at 19:20
  • 1
    Hint: Don't skip ahead by threes. Use the modulo operator to check if you're on "every third" instead. – ravnsgaard Nov 18 '18 at 19:50

1 Answers1

2
while (aPhrase[i]) {
    c = aPhrase[i];
    if (isVowel(c)) 
        c = '!';
    else if ((i % 3) == 0)
        c = toupper(c);
    putchar(c);
    ++i;
}
Remy Lebeau
  • 555,201
  • 31
  • 458
  • 770