I am having trouble using a function statement in order to count vowels in an input statement here is a detailed description on what the program is intended to do:
1) Get line from user (ex. hi, this is a sentence.)
2) Program must recognize every vowel in the input sentence and count.
3) Must be done using some kind of loop and a function statement.
+++(I was thinking of a for loop)++++
4) Must total up every vowel found in the input sentence and out put data
Here is what I have so far, any suggestions will be greatly appreciated. Thank You
#include <iostream>
#include <string>
using namespace std;
char vowels(char a, e, i, o, u);
int main()
{
string input;
int i;
char ch;
cout << "Please enter text: ";
getline(cin, input);
cout << "You entered: " << input << endl;
cout << "The string is " << input.length() << " characters long." << endl;
for(i = 0; i < input.length(); i++)
cout << input[i];
cout << endl << endl;
return 0;
}
char vowels(char a, e, i, o, u)
{
char ch;
int vowelCounter = 0;
if (ch = vowels; vowelCounter++)
cout << input[i];
return vowelCounter;
}

New Topic/Question
Reply




MultiQuote





|