subject

Lab 12B: Palindromes with Files Overview
This is a demonstration of reading and writing files.
Objectives
Be able to read from an input file, perform string manipulation on each line of the file, and write to an output file.
Provided input file:
A single input file named something like myinput. txt is provided that contains a few lines of text.
Description
Create a program to read each line of an input file, determine if the text on the line is a palindrome, and write "palindrome' or 'not a palindrome' to the output file depending on the input. Recall from lab 16.23 that a palindrome is a word or a phrase that is the same when read both forward and backward. In this program, you need to ignore spaces when determining if a phrase is a palindrome. Examples are: 'bob," "sees," or "never odd or even" (ignoring spaces).
You will read the line from a text file, use a function called palindromeChecker to determine if the line is a palindrome. Your function should take a string and return either the string palindrome or not a palindrome, as applicable.
You will write the results to a text file and display the results to the user as shown below.
You may refer to labs 8C and 13B and reuse your code from those labs, as applicable.
Sample Output to the file from the Provided Input File
palindrome
palindrome
not a palindrome
palindrome
not a palindrome
palindrome
Sample Output to the User from the Provided Input File
bob ==> palindrome
sees ==> palindrome
over the moon ==> not a palindrome
never odd or even ==> palindrome
statistics ==> not a palindrome
dr awkward ==> palindrome

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 19:30
Which of the following are types of formatting you can apply to a spreadsheet? choose all that apply.
Answers: 3
question
Computers and Technology, 22.06.2019 03:20
Which of these is a benefit of social networking? oa. hiding your true identity from friendsob. avoiding talking to people in personoc. spending time with friends instead of studyingod. connecting with new people
Answers: 2
question
Computers and Technology, 22.06.2019 07:00
Robots with telescoping arms are sometimes used to perform tasks (e.g., welding or placing screws) where access may be difficult for other robotic types. during a test run, a robot arm is programmed to extend according to the relationship r = 3 + 0.5cos(4θ) and the arm rotates according to the relationship θ=−π4t2+πt , where r is in feet, θ is in radians, and t is in seconds. use a computer program to plot the path of tip a in x and y coordinates for 0 ≤ t ≤ 4s.
Answers: 2
question
Computers and Technology, 22.06.2019 20:00
What is the worst-case complexity of the maxrepeats function? assume that the longest string in the names array is at most 25 characters wide (i.e., string comparison can be treated as o( class namecounter { private: int* counts; int nc; string* names; int nn; public: namecounter (int ncounts, int nnames); int maxrepeats() const; }; int namecounter: : maxrepeats () { int maxcount = 0; for (int i = 0; i < nc; ++i) { int count = 1; for (int j = i+1; j < nc; ++j) { if (names[i] == names[j]) ++count; } maxcount = max(count, maxcount); } return maxcount; }
Answers: 3
You know the right answer?
Lab 12B: Palindromes with Files Overview
This is a demonstration of reading and writing fil...
Questions
question
English, 31.08.2020 19:01
question
Mathematics, 31.08.2020 19:01
Questions on the website: 13722361