Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

the number of palindromes found. The function does not return anything, it formatted table of palindromes counts on the screen. 3) A function called Toupper

image text in transcribed
image text in transcribed
image text in transcribed
the number of palindromes found. The function does not return anything, it formatted table of palindromes counts on the screen. 3) A function called Toupper that takes in a string and converts it into a the new string 4) A function called IsPa1indromeInArray, you are searching for, the array of palindromes and the size of this array position of the palindrome in the array, if the palindrome is not found, the function returns -1 5) A fu it receives a string that holds the palindrome nction called Countword, it takes the word that was just read from file, the array of conjunctions, the array of count of conjunctions, and the size of these arrays. Since they are parallel arrays, both have the same size. This function checks if the word is a conjunction, if it is then it finds its position in the array, and increments its count in the counts parallel array 6) A function called Pr intwordCount, it receives the array of conjunctions, the array of counts of conjunctions, and the size of these arrays. It prints out the table of conjunctions with their respective counts. Main Program The main program will get the name of the file from the command line using its parameters argc and argv. You will open that file for input. If the file is not successfully opened, you will print an informative error message and exit the main program. Remember to use cerr to display error messages. Next you declare all the needed arrays and variables and initialize them You will then begin reading through the file word by word. You will then count that word using the Countword function, then you will check if it is a palindrome and if it is, and it is a new one you will add it to the palindromes array and increment its count in the palindrome count array. If the palindrome word is already in the array, you will increment the correspondent position in the count array After you finish reading through the file, you will of course close the file. Then call your first print routine to print the conjunctions count. Next call the second print routine that will show the palindromes found and their count. Error Handling: error handling. Other than checking the file was opened successfully, you should not have to include any other When you design your functions Make sure that all object parameters are passed by reference. In other words, if you are passing a string object or a stream object, pass by reference. . If don't intend for your function to modify an object or array parameter, place const keyword before the parameter. The compiler will then make sure you do not accidentally modify that parameter. In this lab many, but not all, of the object and array parameters of the functions described above should be declared const. Here is some guidance specific to this lab: 1) Declare the array of conjunctions as const string CONJUNCTIONSI] (.)check 2) For the parallel arrays, you should not specify the size when you define the array of the declaration at the beginning of this document. specific words. Let C++ count it for you based on the list of words you initialize it with Then use sizeof ()/sizeof(first element of array) when you specify the size of the count array

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Management System MCQs Multiple Choice Questions And Answers

Authors: Arshad Iqbal

1st Edition

1073328554, 978-1073328550

Students also viewed these Databases questions