Write a C++ program to read a text file containing a list of vocabulary words in
ID: 666143 • Letter: W
Question
Write a C++ program to read a text file containing a list of vocabulary words in alphabetical order. I have the word (text) file that the program will read. The program should access the word list file and compute and display the following statistics:
a) total number of words are in the file (over 100,000 words)
b) # words begin with the letter 't'
c) # of words that have no vowels (a, e, i, o, u, y) Note: include ‘y’
d) average length of the words (use length() command)
e) minimum length of the words (shortest word length; display length and the shortest word)
f) maximum length of the words (longest word length; display length and the longest word)
h) # of words with all vowels (only vowels; a,e,i,o,u). May contain one or more vowels.
i) # of words that begin with “sh”
Explanation / Answer
for(int i = 0; i <= data.size()-1;i++)
{
String words=data[i];
If(word.at(0)==’t’)
{
startwithT.push_back(words);
If(word.at(0)==’s’ && word.at(1)==’h’)
{
startwithSH.push_back(words);
startwithOVWELS.push_back(words);
startwithnoOVWELS.push_back(words);
for(int i = 0; i <= startwithT.size()-1;i++)
{
for(int i = 0; i <= startwithSH.size()-1;i++)
{
for(int i = 0; i <= startwithOVWELS.size()-1;i++)
{
for(int i = 0; i <= startwithnoOVWELS.size()-1;i++)
{
int maximumValue(apvector<int> &array)
{
int length = array.length( );
int max = array[0];
for(int i = 1; i<length; i++)
{
if(array[i] > max)
max = array{i};
}
return max;
}
int maximumValueaddress(apvector<int> &array)
{
int length = array.length( );
int max = array[0];
for(int i = 1; i<length; i++)
{
if(array[i] > max)
max = i
}
return max;
}
int minimumValue(apvector<int> &array)
{
int length = array.length( );
int min = array[0];
for(int i = 1; i<length; i++)
{
if(array[i] > min)
min = array{i};
}
return min;
}
int minimumValue address(apvector<int> &array)
{
int length = array.length( );
int min = array[0];
for(int i = 1; i<length; i++)
{
if(array[i] < min)
min = i
}
return min;
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.