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

C++ Design a program that prompts the user to enter a string. The program should

ID: 673152 • Letter: C

Question

C++

Design a program that prompts the user to enter a string. The program should then display the number of vowels and the number of constants in the string.

The program must be modularized, using for loops or while loops.

This is what i have so far....

#include
#include
#include
#include

using namespace std;

double stringCounter(int count, string sentence, int vowel);

int main()
{
   string sentence = " ";
   int vowel = 0;
   int consonant = 0;
   int count = 0;


   stringCounter(count, sentence, vowel, consonant);

   return 0;
}

double stringCounter(int count, string sentence, int vowel, int consonant)
{
   cout << "Enter sentence to count vowels and consonants: ";
   getline(cin, sentence);

   int count = sentence.length() - 1;

   for (int i = 0; count.length(sentence)-1; i++)
   {

       if (count=="a" || count == "e" || count == "i" || count== "o" || count== "u")
       {
           vowel = vowel + 1;

       }
       if (count!= "")
       {
           consonant = consonant + 1;
       }
       count++;
   }
   cout << "Number of Vowels in string: " << vowel << endl;
   cout << "Number of Consonants in string: " << consonant << endl;

   return vowel, consonant;
}

Explanation / Answer

#include #include int main () { using namespace std; string sentence (" "); int vowels(0), consonants(0), spaces(0), others(0); cout
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