0

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
}
2
Contributors
1
Reply
2
Views
9 Years
Discussion Span
Last Post by zandiago
0

dabu....welcome aboard...I reccommend taking a look at the Rules & FAQ for the daniweb forum.This forum has been marked as SOLVED....so you may need to srart your own thread to get the attention of someone to help you. Furthermore....if you don't want them to count the vowels and constanants...what do you want it to do?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.