View Single Post
Old 10-23-2004, 03:37 PM   #6 (permalink)
Valmont
[code][/code] enforcer
 
Valmont's Avatar
 
Join Date: Mar 2003
Location: Netherlands
Posts: 1,544
Valmont is on a distinguished road
I didn't even bother to look closely at your code.
Code:
wordr[i] = word[j];
I've explained why this doesn't work in your case.

"Shadowing" means that you redeclared a variable in a function, whilst that variable name already exists in as a parameter in that function.

Read my my post again, thorough.
In total I gave three possible solutions by the way.
This I really do NOT appreciate! It is saturday evening an I could think of much cooler things to do right now.
Most dissapointing.


Now this (although right now you don't deserve it):
Code:
void verify(string reversed, string word)
{
	string wordr;
	string wordin;
	if (wordin == wordr)
	{
		cout << "This word is a palindrome" << endl;
	}
	else
	{
		cout << "This word is not a palindrom" << endl;
	}
}
I didn't look at this code closely either so I don't know if it works. But one thing is sure:
You call it "verify" yet it is also responsible for output (cout<<..). Make your mind up. What does it do. Name it like that. For what it is worth (I suspect nothing), cout doesn't belong there. Let it check only.

I'm gone.
__________________
Valmont is offline   Reply With Quote