Hi everyone, I am new to this programming and I was wondering if someone, well anyone can help me. I have this assignment due in a few days and I don't know where to start.

The challenge is: Evaluate if the word or sentence entered by the user is a palindrome. A palindrome is a word or sentence which when spelt backwords or fowards is the same.

Details:
1. Prompt the user to enter a possible palindrome.
a. allow the user to enter a word or sentence length 1 to 80
characters.

2. Evaluate if the word or sentence is a plaindrome.

3. Allow the user should stop the program at any time.

4. When the program is stopped by the user, display the following:
a. Number of words or sentences entered.
b. Number of palindromes encountered.

If anyone can help me, I would really appreciate it.

Thank you.

What help do you need?

hey i really have no idea where to start! oh thank you for replying.

You could start with a function that gets the input from the user.

ok thank you, i would try that and i would get back to you.

If I were you, I would regard each of your details, 1, 2, and 4, as an individual problem to write a function for. Then the program is a simple combination of these functions, meeting detail 3.

hey i really have no idea where to start! oh thank you for replying.

you could start by telling us in what language this program is to be written :)

oh i have to write it in c++

hey i started the program by displaying "enter a possible palindrome", my lecturer said how i have to use arrays and when i was doing some research i found examples with cout and other stuff i didnt understand.

Do you understand how arrays work?

hey, so i was doing some research and i got the first part,

#include <iostream.h>
#include <math.h>
#include <string.h>

int main()
{
char original[20],reversed[20];
int length;
cout <<"Enter a string"<<endl;
cin.get (original,20);
cin.ignore(80,'\n');
length=strlen(original);
strcpy(reversed,original);
for (int i=0;i<=length-1;i++)
{
reversed[length-1-i]=original[i];
}
cout <<original<<" "<<reversed<<endl;
return 0;
}

can u guide me on what to do?

i have an idea..we started that in our class today.

All your header files are non-standard use <iostream> <cmath> <string> instead of what you are using.What compiler are you using?


Palindrome problem is not new here. Remember, you should search the forum first before starting a new thread.
Here are few thread I found by simply using the search option :)
http://www.daniweb.com/forums/thread62808.html
http://www.daniweb.com/forums/showthread.php?t=176303&highlight=palindrome
http://www.daniweb.com/forums/showthread.php?t=101091&highlight=palindrome
http://www.daniweb.com/forums/showthread.php?t=94190&highlight=palindrome
http://www.daniweb.com/forums/showthread.php?t=63936&highlight=palindrome

im using a turbo c++ program, thank you for the threads

>im using a turbo c++ program, thank you for the threads
so don't use the header file I mentioned as they won't work on ancient compiler like Turbo C++.
Read the thread. Take a pencil paper and construct a algorithm.
Get back to us with your progress.

Hey, could you write the program?

hey, i'm really trying..my lecturer gave a hint and it not really helping.
dont worry i would let you al know what i came up with.

Hi everyone, I am new to this programming and I was wondering if someone, well anyone can help me. I have this assignment due in a few days and I don't know where to start.

The challenge is: Evaluate if the word or sentence entered by the user is a palindrome. A palindrome is a word or sentence which when spelt backwords or fowards is the same.

Details:
1. Prompt the user to enter a possible palindrome.
a. allow the user to enter a word or sentence length 1 to 80
characters.

2. Evaluate if the word or sentence is a plaindrome.

3. Allow the user should stop the program at any time.

4. When the program is stopped by the user, display the following:
a. Number of words or sentences entered.
b. Number of palindromes encountered.

If anyone can help me, I would really appreciate it.

Thank you.

Frist number of words in a palindrome should alway be an odd num say 3,5,7
so first write a code to check whether the input is an odd no,
You can the syntax sizeof() to find the size of the input, use an array to receive the input string. use a for loop to check palindrome condition.

I have project on error correction codes can someone help me with some pdf regarding huffman codes.

hey everyone this is what i have so far, and its working perfect..

#include <stdio.h>
#include <string.h>

#define TRUE 1
#define FALSE 0

void main ()
{

char string[80];
int isPalindrome = TRUE;
int i,j;


printf("Enter a word: ");
gets(string);
j = strlen(string) - 1;
i = 0;


while(i <= j && isPalindrome) {

if(string != string[j]) {
isPalindrome = FALSE;
}
i++;
j--;
}

if(isPalindrome) {
printf("%s is a palindrome!\n", string);
}
else {
printf("%s is not a palindrome\n", string);
}
}

What? Why did you suddenly start using C?

commented: Hahahahha Exactly! +12

Hey, I have to write this program in turbo c++...the last code with
# include <stdio.h>
# include < string.h>
is what I came up with so far, the first coding was some research I did and I realize it was the wrong thing.

I think so far I got the program to check if a word entered is a palindrome or not. You can run it and check it as well.

How can I check the number of words or sentences entered?

Hi, can anyone please help me? I am really lost and confused! I dont know how to check the number of palindromes encountered and the number of words or sentences entered!
Please, I am really in need of help!
Thank you, if you can help.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.