help with palidrome


I need some help with this if anyone coul help please.
Write a program, which will ask for and read in a line of text characters. The program will then determine if the line of text forms a palindrome and print whether it is or not. After printing this message, the program will ask for another line of text. The program will end when the line of text read matches the string “END” (letters in all caps).
Thanks,
Bianka
hi, hope this is what u r looking for, but please stop posting your homeworks man !!

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include <iostream>
#include <string>
using namespace std;

int main()
{
string input, rInput="";
	
while(1)
{
rInput="";
getline(cin, input, '\n');

if (input == "END") break;

for(int i = input.size()-1; i >= 0; i--)
    rInput += input[i];
	
rInput == input ? cout << "Palindrome\n" : cout << "Not Palindrome\n";;
}
}
Last edited on
Thank you so much Chatterjee! I realy appreciate your help.
I just can not get my program my work.
Why did you put the brakets twice in the end of the program, its probabily a realy stupid question. But I am trying very hard to understand c++ but I am having preaty dificult time.
Anyways, Thank you again.
B
you are most welcome !! yeah, i accidentally put the ";" twice in the end. C++ is still considered to be one of the most obfiscicated language, it will take time. One of my suggestion to you would be to read some book on algorithm development prior to c++. You can even be in touch wid me at a.n.chatterjee@gmail.com, and can share your problems.
Last edited on
Thank you Chatterjee. I f I get a problem I will email you.
Have a great day!
B
Topic archived. No new replies allowed.