RSS Forums RSS
Please support our C++ advertiser: Programming Forums

stack palindrome problem?

Join Date: Jul 2005
Posts: 1,395
Reputation: Lerner is just really nice Lerner is just really nice Lerner is just really nice Lerner is just really nice Lerner is just really nice 
Rep Power: 10
Solved Threads: 196
Lerner Lerner is offline Offline
Nearly a Posting Virtuoso

Re: stack palindrome problem?

  #8  
Sep 14th, 2005
string word;  //declare a single string
for(;;)  
{
  if(i.eof())  //if find EOF 
   break;    //stop
			
  i >> word;  ///else read in each word, but don't do anything with it.
}
Palindrome_mgr(word, o); //send last word read in to this function.

Do you see any problem with logic in the comments I wrote?
You will do yourself a big favor by testing code as you write it, one
step at a time, and not as one big bolus.

BTW: You shouldn't be testing for eof() to break out of the loop as
it will likely cause an overread by one. But that would be then next
problem you encounter if you fix the more obvious logic problem.
Reply With Quote  
Forums | Blogs | Tutorials | Code Snippets | Whitepapers | RSS Feeds | Advertising
All times are GMT -4. The time now is 5:06 am.
Newsletter Archive - Sitemap - Privacy Statement - Acceptable Use Policy - Contact Us
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC