delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/08/27/19:25:38

X-WM-Posted-At: MailAndNews.com; Mon, 27 Aug 01 19:25:08 -0400
X-WebMail-UserID: Ramiman12
Date: Mon, 27 Aug 2001 19:25:08 -0400
Sender: Ramy Elmeligy <Ramiman12 AT MailAndNews DOT com>
From: Ramy Elmeligy <Ramiman12 AT MailAndNews DOT com>
To: djgpp AT delorie DOT com
X-EXP32-SerialNo: 50000000
Subject: RE: Program, uses compare() to check for anagrams, but doesnt work
Message-ID: <3B8B9501@MailAndNews.com>
Mime-Version: 1.0
X-Mailer: InterChange (Hydra) SMTP v3.61.08
Reply-To: djgpp AT delorie DOT com

>>    for( ; a < greater, equal == 0 ; a++)
>>      {
>>       input1.substr(a, b).compare(input2, c, b);
>>      }
>This is an infinite loop. equal is always 0. Probably your intention was to
>write something like :
>
>for( ; a < greater && equal == 0 ; a++)
>	equal = input1.substr(a, b).compare(input2, c, b);
>
>

I thought that if the two values or characters that the compare() function is 
comparing are not equal, it will return a value other than 0, and if they are 
it will return 0..? am i mistaken?

------------------------------------------------------------
 Get your FREE web-based e-mail and newsgroup access at:
                http://MailAndNews.com

 Create a new mailbox, or access your existing IMAP4 or
 POP3 mailbox from anywhere with just a web browser.
------------------------------------------------------------

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019