Hi I'm supposed to be writing a program that counts in a given text, the words that contain at least three different vowels (a,e,i,o,u)
For my test run I have to use "unquestionably ", but I can't anything to work. Here's what I have so far.
It keeps telling me to input a string of characters, but even when do put in "unquestionably " into the put space it doesn't help. Can anyone give me a hand, please?
For my test run I have to use "unquestionably ", but I can't anything to work. Here's what I have so far.
Code:
#include <iostream> #include <string> #include <cstring> using namespace std; void stringout(); string input; int main() { cout << "Input a string of characters: " ; cin >> input; cout << "You entered: " << input << endl; stringout(); return 0; } void stringout() { char ch; int vowel=0, consonant=0; int length = input.length(); for (int i = 0; i < length; i++) { if ((ch == 'a') || (ch == 'e') || (ch == 'i') || (ch == 'o') || (ch == 'u') || (ch == 'A') || (ch == 'E') || (ch == 'I') || (ch == 'O') || (ch == 'U')) ++vowel; else ++consonant; } cout << "This has " << input.length() << " characters, " <<endl; }
Comment