X-WM-Posted-At: MailAndNews.com; Mon, 27 Aug 01 16:28:24 -0400 X-WebMail-UserID: Ramiman12 Date: Mon, 27 Aug 2001 16:28:24 -0400 Sender: Ramy Elmeligy From: Ramy Elmeligy To: djgpp AT delorie DOT com X-EXP32-SerialNo: 50000000 Subject: compare() program code update Message-ID: <3B8D144F@MailAndNews.com> Mime-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit X-Mailer: InterChange (Hydra) SMTP v3.61.08 Reply-To: djgpp AT delorie DOT com alright, this is as far as i can get it, i made some obvious fixes but the same error is in. //Exercise - Anagram Checker #include #include using namespace std; int main() { string input1; string input2; cout << "Enter a word: "; cin >> input1; cout << endl; cout << "Enter another word: "; cin >> input2; cout << endl; cout << "Let's see if your words are anagrams of each other. " << endl; int length = 0; if(input1.length() != input2.length()) { cout << "\nYour words have different lengths, so they can't be anagrams!"; return 0; } else length = input1.length(); int equal = 0; int a = 0; int b = 1; int c = 0; equal = input1.substr(a, b).compare(input2, c, b); for( ; c < length ; ) { for( ; a < length, equal == 0 ; a++) { input1.substr(a, b).compare(input2, c, b); } if(a >= length) { a = 0; c++; } } if(input1.substr(a, b).compare(input2, c, b) != 0) { cout << "The words are not anagrams."; return 0; } else { cout << "The words are anagrams! What luck!"; return 0; } } ------------------------------------------------------------ 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. ------------------------------------------------------------