I have an assignment that I need help with setting up for an assignment. I need some help finish building the functions. As far as how could I count the number of vowels, consonants, and a combination of vowels and consonants.
And is there anything else that I need to code in that I am missing? And what needs to be coded into the program?
Programming Problem
You will design, code and debug a program that contains functions that accept a pointer to a C-string as its argument. The functions you will code will count the number of vowels, the number of consonants or both in the string depending upon a user’s menu choice (see menu below).
The program flow is:
1. The user is asked to enter a string
2. The program displays the following menu:
a. Count the number of vowels in the string
b. Count the number of consonants in the string
c. Count both the vowels and consonants in the string
d. Enter another string
e. Exit the program
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
|
#include <iostream>
#include <string>
using namespace std;
// function prototypes
countVowels (int);
countConsanants (int);
countVowAndCon (int);
entAntStr (int);
int main()
{
string countString;
string anthString;
cout << "Please type in a sentence about anything: " << endl;
cin >> countString;
cout << "Please enter another sentence: " << endl;
cin >> anthString;
return 0;
}
// user defined functions
int countVowels (int countval) {
index;
for (index = 0; index < countString; index++) {
}
}
int countConsants (int countval) {
index;
for (index = 0; index < countString; index++) {
}
}
int countVowAndCon (int countval) {
index;
for (index = 0; index < countString; index++) {
}
}
|