Question

with word per words, one or charaenera one word another For charenwy welcome to use the C++ MEring elass rather than Problem ac tyle string word whether or not (ora C+ string werd if you wish) and returns true or the same and the string is a palindrome (A is a string which reads deed, forwards some classic are radar, moecar, redivider, toote bib, civic, redder and madam) Use Woea. len Use use bool Palcheck stewg noed) (b). Use your function from part (a in a complete c++program which, for each small letter a through z, calculates and outputs the length of the longest palindrome in the Ale which begins with the letter. (Dont worry about ties.) For example, for the very simple input file: bib dad radar dinosaur kayak deed bob did civic madam yay a elephant year Your output should consist of the 26 lines: maximal length of palindromes beginning with a-1 maximal length of palindromes beginning with b -3 maximal length of palindromes beginning with c 5 maximal length of palindromes beginning with d-4 maximal length of palindromes beginning with e-0 maximal length of palindromes beginning with f 0 maximal length of palindromes beginning with y 3 maximal length of palindromes beginning with z-0 (continued)
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Compile Execute >Share Code main.cpp x 1 #include<iostream> #include(algorithm» #include<string.h> #include-fstream» 4 6 usin

I mentioned above code for Question (a).

Add a comment
Know the answer?
Add Answer to:
Write a function palcheck (char word II) which takes a C-style string word (or a C++...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Write a function check palindrome, which takes a string x as argument and which returns True...

    Write a function check palindrome, which takes a string x as argument and which returns True if x is a palindrome, and False otherwise. A palindrome is a word that reads the same backwards as forwards (like for example “racecar”). Your function should be recursive (i.e. call itself) and proceed as follows. 1. If x is a string of length 0 or 1 return True. 2. If the rst and the last letter of x are di erent, return False....

  • Your program must prompt the user to enter a string. The program must then test the...

    Your program must prompt the user to enter a string. The program must then test the string entered by the user to determine whether it is a palindrome. A palindrome is a string that reads the same backwards and forwards, such as "radar", "racecar", and "able was I ere I saw elba". It is customary to ignore spaces, punctuation, and capitalization when looking for palindromes. For example, "A man, a plan, a canal. Panama!" is considered to be a palindrome....

  • I keep getting an error code in my C++ program. It says "[Error] 'strlen' was not...

    I keep getting an error code in my C++ program. It says "[Error] 'strlen' was not declared in this scope" in my main.cpp. Here are my codes. main.cpp #include <iostream> #include <string> #include "functions.h" using namespace std; //definition of the main function. //takes arguments from the command-line. int main(int argc, char *argv[]) { //Determine if you have enough arguments. //If not, output a usage message and exit program if (argc<2 || (argc == 2 && argv[1][0] == '-')) { //call...

  • C Program: Write the following function that takes a user input string, computes, and determines whether the input is palindromic or not by returning either true or false:

    A palindrome is a word, phrase, number, or other sequence of symbols or elements that reads the same forward or reversed. Examples: “Dad”, “Anna”, “Never odd or even”, etc. For this problem, we will only consider a string to be palindromic if its combined alpha-numeric characters (‘A’-’Z’, ‘a’-’z’, and ‘0’-’9’) can be read the same both forward and backward, by skipping all other non-alphanumeric characters.Write the following function that takes a user input string, computes, and determines whether the input is palindromic or not...

  • Palindrome Detector C++ A palindrome is any word, phrase, or sentence that reads the same forward...

    Palindrome Detector C++ A palindrome is any word, phrase, or sentence that reads the same forward and backward. Here are some well-known palindromes: Able was I, ere I saw Elba A man, a plan, a canal, Panama Desserts, I stressed Kayak Write a program that determine whether an input string is a palindrome or not. Input: The program should prompt the user "Please enter a string to test for palindrome or type QUIT to exit: " and then wait for...

  • *****Complete void example 4, 7, 8, 9, 10 #include <iostream> #include <fstream> #include <vector> #include <string>...

    *****Complete void example 4, 7, 8, 9, 10 #include <iostream> #include <fstream> #include <vector> #include <string> using namespace std; void rtrim(std::string& str, const std::string& chars = "\t\n\v\f\r ") { str.erase(str.find_last_not_of(chars) + 1); } vector<string> *get_words() { vector<string> *words = new vector<string>(); fstream infile; string word; infile.open("words.txt"); getline(infile, word); while(infile) { rtrim(word);     words->push_back(word);     getline(infile, word); } return words; } void example_1(vector<string> *words) { // find words that contain the substring 'pet' and 'cat' // HINT: use find(str, p) method....

  • Program is in C++. Write a function named wordStatsPlus that accepts as its parameter a string...

    Program is in C++. Write a function named wordStatsPlus that accepts as its parameter a string holding a file name, opens that file and reads its contents as a sequence of words, and produces a particular group of statistics about the input. You should report: the total number of lines; total number of words; the number of unique letters used from A-Z, case-insensitively, and its percentage of the 26-letter alphabet; the average number of words per line (as an un-rounded...

  • Program is in C++.   Write a function named wordStatsPlus that accepts as its parameter a string...

    Program is in C++.   Write a function named wordStatsPlus that accepts as its parameter a string holding a file name, opens that file and reads its contents as a sequence of words, and produces a particular group of statistics about the input. You should report: the total number of lines; total number of words; the number of unique letters used from A-Z, case-insensitively, and its percentage of the 26-letter alphabet; the average number of words per line (as an un-rounded...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT