/* From Page 261
 *
 *   Examle of StrCmp in a program
 */

#include <iostream>
#include <string>

#define STRINGSIZE 256

//Implementation of StrCmp

int StrCmp(char String1[], char String2[]) {

	int i=0;
	while (String1[i] == String2[i] && String1[i]!='\0') {
		i++;
	}//end while
	return (String1[i] - String2[i]);

} //end StrCmp()

using namespace std;

void main() {

	char Buffer1[] = {"This is a string!"};
	char Buffer2[] =  "This is a string!";   //another way to declare
	char Buffer3[] =  "This string is different";

	if (StrCmp(Buffer1, Buffer2) != 0) {
		cout << "Buffer1 and Buffer2 are different" << endl;
	} else {
		cout << "Buffer1 and Buffer2 are the same" << endl;
	}

	if (StrCmp(Buffer1, Buffer3) != 0) {
		cout << "Buffer1 and Buffer3 are different" << endl;
	} else {
		cout << "Buffer1 and Buffer3 are the same" << endl;
	}


} //end main()

/*

  SAMPLE OUTPUT:

Buffer1 and Buffer2 are the same
Buffer1 and Buffer3 are different

  */