|
| ||||||||||
| Tags: palindrome, program |
![]() |
| | Thread Tools | Search this Thread |
|
#1
| ||||
| ||||
| Program to determine a word or a phrase is a palindrome in C/C++
|
|
#2
| ||||
| ||||
| Re: Program to determine a word or a phrase is a palindrome in C/C++
Ideally you can do coding for the word but for the phrase, it is not at all possible. As you might be knowing that phrase will include "spaces". So how will keep track of those spaces? |
|
#3
| ||||
| ||||
| Re: Program to determine a word or a phrase is a palindrome in C/C++
Actually, my principle is that my program removes spaces of the sentence or when the program faces a space and it will increase to next character. So in that way the spaces would not be a problem in our code, right? |
|
#4
| ||||
| ||||
| Re: Program to determine a word or a phrase is a palindrome in C/C++
In my opinion the biggest problem is not space but the storage of phrases that you must perform before! |
|
#5
| ||||
| ||||
| Re: Program to determine a word or a phrase is a palindrome in C/C++
See the below code: Code: # include <stdio.h> # include <string.h> char sentence [50] = "Johnson and Johnson"; char temp [50]; int i; int LEN; for (i = 0; sentence! = "\ 0"; + + i) + + LEN; for (i = 0; i <LEN; + + i) temp = sentence [- LEN]; if (strcmp (temp, sentence)) printf ( "The sentence is a palindrome"); else printf ( "The sentence is not a palindrome"); Quote:
|
![]() |
|
| Thread Tools | Search this Thread |
| |
Similar Threads for: "Program to determine a word or a phrase is a palindrome in C/C++" | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to extract a word from phrase from Excel columns | Kumar esan | MS Office Support | 5 | 24-02-2012 04:17 PM |
| How do I search files containing “a word or phrase in the file” in windows 7 | Mewad | Operating Systems | 4 | 18-01-2011 08:46 AM |
| C# program for palindrome | Smita.bendal | Software Development | 5 | 22-12-2009 02:07 PM |
| how to write program on palindrome in java? | Linoo | Software Development | 3 | 26-11-2009 04:19 PM |
| C++ program to display ASCII code of a word or phrase | Sonic | Software Development | 2 | 12-11-2008 12:09 PM |