Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Programming Problem Palindromes are words or phrases that read the same backward

ID: 3634916 • Letter: P

Question

Programming Problem

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 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.!


How would I get this to work, I have tried but can't get it working right.

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]