Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

ATTENTION!!!: This assignment is for a basic and introductory C++ course. As suc

ID: 3836508 • Letter: A

Question

ATTENTION!!!: This assignment is for a basic and introductory C++ course. As such, please do not use complex or obscure opperations and headers that would typically be used in advanced classes as we have not learned them yet. Use only very simple functions and headers. If you are unsure of whether a technique is too advanced, dont use it. If you can answer the question without using a function, please do so.

"C type" string is implied to mean an array of characters with an end of string mark following the last character.

Write a function named VowelConsonant which will have three parameters - all "C type" strings. The function will place all vowels (the characters a, e, i, o, u) from the first string into the second string and all consonants from the first string into the third string. Assume the size of each string is sufficient to hold the characters. Case of letters is not significant.

Explanation / Answer

void vowelConsonant(char* words, char*vowels, char*consonants)
{
    int i = 0, j = 0, k = 0;
    while(words[i] != '')
    {
       switch(words[i])
       {
          case 'A':
          case 'a':
          case 'E':
          case 'e':
          case 'I':
          case 'i':
          case 'O':
          case 'o':
          case 'U':
          case 'u':   vowels[j++] = words[i]; break;
          default:   consonants[k++] = words[i]; break;
       }
       i++;
    }
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote