I was wondering if you could help me with this. I really don't know what to do next. I am sending all of the information for the assignment and it is alot. Sorry but I would like to thank you for looking at it ahead of time.
Write and test a C++ program to complete the following project.
Read the words from a file named “SelectWords.txt” into a 100-element array of strings.
Declare and initialize to zeroes a parallel array of whole numbers for word counts
Declare and initialize to zeroes a parallel array of doubles for word frequencies.
Declare two strings to hold the shortest and longest words in the data file. Initialize the shortest word to “thisisarunonsentencewithlotsofletters” and the longest word to “a”.
Declare a whole number variable to hold the total word count, and initialize it to zero.
Open and read one of three data files, provided by the instructor, examining each word as it is read.
If the word matches one in the SelectWords array, increment the corresponding count in the parallel array of whole numbes.
If the word is shorter than the word currently in the ShortestWord string, replace the contents of that string with the word from the data file.
If the word is longer than the word currently in the LongestWord string, replace the contents of that string with the word from the data file.
Increment the TotalWordCount by one for each word read from the data file.
After all words have been read from the data file, calculate the frequency of occurrence of each of the SelectedWord’s by dividing its count by the TotalWordCount, and save the calculated value in the corresponding element of the array of doubles.
Display the name of the data file, the shortest word, longest word, and total word count.
Display the arrays of SelectedWord’s, their counts, and their frequency of occurrence in a columnar fashion. Format the frequency of occurrence with 2 significant digits and a field width of 6 characters.
For bonus credit: Declare an array of at least 30 integers and initialize each of them to zero. Use each to accumulate a count of all the words of that length. For instance, array should hold a count of all words that were read from the data file that had a length of 5 characters. After all other output is complete, display the contents of this array, formatted as “N words of length M”, substituting the count for N and the array index for M. Do not display word lengths for which the count is zero.
This is what I have so far:
using namespace std;
string wholeNum, count;
InFile.open( "SelectWords.txt" );
for (int i = 0; i < 100; i++ )
This is one TXT file:
I have 5 TXT file that I have to put inside the program. Any help would be great.
I really don't have the time now to do all these please, because I am planning for my marriage :( but here is quick thing you can do, you can find on google, bitwise function that does each task you require and then combine them, I will try to do it gradually as often as I got time to sit on the computer but this month, I am stucked up. Am really sorry. Perhaps, once i am free in any given day, I will jump back to the question please.