Programming Problem Palindromes are words or phrases that read the same backward
ID: 3634918 • Letter: P
Question
Programming ProblemPalindromes 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.
** I need to know how to compare(or change) Higher case alphabet to lower case alphabet when using two different arrays for input line forwards and backwards.
I can't use ascii.
sentences.txt
Vanna, wanna V?
Must sell at tallest sum.
I should get an eighty. Why? Because I get an eighty in all my other classes.
Lager, Sir, is regal.
I don't need documentation. The code is obvious to me. OK, but is it to the next programmer?
Evil olive.
I never thought computer science could be such fun!
Sex at noon taxes.
You expect me to read ten chapters in two days? No, I expect you to read ten chapters over the semester.
Never odd or even.
Explanation / Answer
i have done for using array hope it will address you... #include #include main() { char a[254],b[254],c[254]; printf("enter a string"); scanf("%[^ ]s",&a); strcpy(b,a); strcpy(c,a); //copies string a to b strrev(b); //reverses string b char temp; printf("Original order :%s ", a); for(int i=0;iRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.