include include include using namespace std complete the fu

         #include <iostream>         #include <cstring>         #include <cctype>         using namespace std;          // complete the function count_and_print.         // the function will receive the variables st, vowels and ct.         // the function must count and print the number of lower case vowels (aeiou)         // in the string st. Use strlen and nested loops.            void count_and_print( char           {            }            int main()         {                   char st[25] = \" this is a sentence. \";            char vowels[] = \"aeiou\";            int ct = 0;             // call the function count_and_print                            return 0;           } 

Solution

#include <iostream>
#include <cstring>
#include <cctype>
using namespace std;
void count_and_print( char st[], char vowels[], int ct)
{
int i,j;
for(i=0;i<strlen(st);i++){
for(j=0;j<strlen(vowels);j++){
if(st[i]==vowels[j]){
ct += 1;
}
}
}
cout << \"Number of lower case vowels:\" << ct << endl;
}

int main()
{
char st[25] = \" this is a sentence. \";
char vowels[] = \"aeiou\";
int ct = 0;
count_and_print(st,vowels,ct);
return 0;
}
/*
sample output
Number of lower case vowels:6
*/

 #include <iostream> #include <cstring> #include <cctype> using namespace std; // complete the function count_and_print. // the function will

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site