Lab 12B: Palindromes with Files
Overview
This is a demonstration of reading and writing fil...
![subject](/tpl/images/cats/informatica.png)
Computers and Technology, 22.04.2021 18:50 jadbaubl1449
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](/tpl/images/cats/User.png)
Answers: 1
![](/tpl/images/ask_question.png)
![](/tpl/images/ask_question_mob.png)
Another question on Computers and Technology
![question](/tpl/images/cats/informatica.png)
Computers and Technology, 22.06.2019 16:20
Octothorpe is another name for what common computer keyboard symbol?
Answers: 1
![question](/tpl/images/cats/informatica.png)
Computers and Technology, 22.06.2019 23:30
What does 21 pilots middle aged name as a band 15 years prior to them naming their band 21 pilots?
Answers: 1
![question](/tpl/images/cats/informatica.png)
Computers and Technology, 23.06.2019 09:10
(328 inc. 448 ind. 480 in25. john has a collection of toy cars. he has 2 red cars, 4 blue cars, 4 black cars, and 6 yellowcars. what is the ratio of red cars to yellow cars? a. 1: 2b. 1: 3c. 1: 626. the net of a right triangular prism is shown below.
Answers: 2
![question](/tpl/images/cats/informatica.png)
Computers and Technology, 24.06.2019 02:30
Which option completes the explanation for conflict of interest in an organization
Answers: 1
You know the right answer?
Questions
![question](/tpl/images/cats/en.png)
English, 21.07.2020 18:01
![question](/tpl/images/cats/mat.png)
![question](/tpl/images/cats/mat.png)
![question](/tpl/images/cats/en.png)
![question](/tpl/images/cats/mat.png)
![question](/tpl/images/cats/mat.png)
![question](/tpl/images/cats/ekonomika.png)
![question](/tpl/images/cats/mat.png)
Mathematics, 21.07.2020 18:01
![question](/tpl/images/cats/en.png)
![question](/tpl/images/cats/en.png)
English, 21.07.2020 18:01
![question](/tpl/images/cats/mat.png)
Mathematics, 21.07.2020 18:01
![question](/tpl/images/cats/en.png)
English, 21.07.2020 18:01
![question](/tpl/images/cats/mat.png)
![question](/tpl/images/cats/mat.png)
Mathematics, 21.07.2020 18:01
![question](/tpl/images/cats/mat.png)
Mathematics, 21.07.2020 18:01
![question](/tpl/images/cats/mat.png)
![question](/tpl/images/cats/biologiya.png)
![question](/tpl/images/cats/biologiya.png)
![question](/tpl/images/cats/biologiya.png)
Biology, 21.07.2020 18:01