I don't understand what you are talking about.
Seriously. Read all kind of books about C++ and there is no logical fashion
explanation. Are you kinda kidding? Cuz if you wanted to help, just paste in a single line of code. Is this a C++ word jumble or a C++ forum?
You need to be comparing characters in word to other characters in word.
You even don't say it is like a mirror. The first character with the last, the second with the second to the last etc.
What am i supposed to do?
I don't understand what you are talking about.
Seriously. Read all kind of books about C++ and there is no logical fashion
explanation.
I think all C++ books make the assumption that you have at least a tenuous grasp of logic.
Are you kinda kidding? Cuz if you wanted to help, just paste in a single line of code. Is this a C++ word jumble or a C++ forum?
I feel kind of like I'm trying feed a baby that prefers his nose as the avenue of in-take.
Here's the code I already posted in a slightly different format, with your own added in for getting the word to check:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
int main()
{
cout << "Enter a word or a sentence: ";
string word;
getline(cin, word);
int i = 0; // first character is 0, remember?
int j = word.length() - 1;// remember?
while ( i < j )
{
// Your code goes here...
}
// and here.
}
This is all you're getting from me. You have more than enough information to solve the problem and a demonstrated tendency to write a one-off and not bother tracing through the logic of the code and say "any help?" No. Work it out.
Cuz if you wanted to help, just paste in a single line of code.
How does that help? You're right, this can be solved in just a single line of code, but you're the one who's supposed to do it. If you can't, it shows you're lacking an understanding of even the most basic concepts, so you have to learn those as soon as possible. Without that, you have no chance in hell to complete any of the future tasks you'll get. If your book is bad, get a better one, such as the C++ Primer.
It seems you have given up trying to think of a solution on your own. Describe how to tell whether a word is a palindrome. Then, if you've managed to describe it, put the idea into C++ code.
LOOOOOL my book is C++ Primer 6th edition!
I am 100% sure i am not understanding you, not the book.
All i have understood is this code here and this is my own logic as far as i get:
int main()
{
cout << "Enter a word or a sentence: ";
string word;
getline(cin, word);
int i = 0; // first character is 0, remember?
int j = word.length() - 1;// remember?
while ( i < j )
{
for (int i = word.size() - 1; i >= 0; i--)// Your code goes here...
{
cout << word[i];
}
}
cout << "\n\n";
main();// and here.
}