Palindromes are words or phrases that read the same backwards as forwards. Write
ID: 3634907 • Letter: P
Question
Palindromes are words or phrases that read the same backwards as forwards.
Write a C++ program that indicates whether each line on an input file,
called sentences.txt and given on my homepage, contains a palidrome.
Those lines of sentences.txt that are palidromes should be written to
an output file, called palindromes.txt. For example, if sentences.txt
had the following lines, then palindromes.txt would be as follows.
sentences.txt palindromes.txt
---------------------------- -------------------------------
Abba Abba
Tuna nut. Tuna nut.
Hello! Gnu Dung.
Gnu Dung. No melons, no lemon
No melons, no lemon Man, Oprah's sharp on A.M.!
Pali what?
Man, Oprah's sharp on A.M.!
* YOU ARE NOT ALLOWED TO EDIT (CHANGE) THE INPUT DATA FILE
Use the format and style described in the assignment guidelines.
In order to demonstrate that your program works, you must collect the output.
When handing in your assignment, use a cover sheet and staple your assignment.
Explanation / Answer
#include #include #include char palindrome(char *,int); main(){ char x[50],y[50]; int i=0,j=0,r=0; printf("Type the string "); gets(x); while (x[j]!=''){ if (x[j]>='A' && x[j]Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.