I tried following this code for my program, but counting the consonants and vowels are not doing what I want them to. Is this the correct format to use?
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
void StateInstructions();
void GetInput();
void TurnUpper();
void TurnLower();
int NumVow();
int NumConst();
void RevOrd();
string para;
int main()
{
int vow, consta;
StateInstructions();
GetInput();
TurnUpper();
TurnLower();
vow = NumVow();
cout << "The number of vowels in the paragraph are: " << vow << endl;
consta = NumConst();
cout << "The number of consonants are: " << consta << endl;
RevOrd();
}
void StateInstructions()
{
//statements
}
void GetInput()
{
string prompt;
prompt = "\nPressing 'enter/return' will end your paragraph\n"
"Please enter now\n";
cout << prompt;
getline(cin, para);
}
void TurnUpper()
{
//statements
}
void TurnLower()
{
//statements
}
int NumVow()
{
string stringCopy;
stringCopy = para;
int length, vowCount;
length = stringCopy.length();
vowCount = 0;
char let;
for (int i = 0; i < length; ++i)
{
//transform(stringCopy.begin(), stringCopy.end(), stringCopy.begin(), tolower);
let = tolower (stringCopy[i]);
if (isalpha (let) && (let == 'a' || let == 'i' || let == 'o' || let == 'u'))
++vowCount;
}
return vowCount;
}
int NumConst()
{
string stringCopy;
stringCopy = para;
int length, conCount;
length = stringCopy.length();
conCount = 0;
char let;
for (int i = 0; i < length; ++i)
{
//transform(stringCopy.begin(), stringCopy.end(), stringCopy.begin(), tolower);
let = tolower (stringCopy[i]);
if (isalpha (let) && (let != 'a' || let != 'i' || let != 'o' || let != 'u') && (let != ' '))
++conCount;
}
return conCount;
}
void RevOrd()
{
//statements
}