/*
Nome: Mario
Cognome: Montanari

strcmp()
*/

#include <iostream>
#include <cstring>

#define SIZE 100+1

using namespace std;

int strcmp(const char *src1, const char *src2);

int main(void) {
	char src1[SIZE];
	char src2[SIZE];
	int result;
	
	cout << "Inserisci una prima frase: ";
	cin.getline(src1, SIZE);
	
	cout << "Inserisci una seconda frase: ";
	cin.getline(src2, SIZE);
	
	result = strcmp(src1, src2);
	
	if (result == 0) {
		cout << endl << "src1 = src2" << endl;
	} else if (result < 0) {
		cout << endl << "src1 < src2" << endl;
	} else {
		cout << endl  << "src1 > src2" << endl;
	}
	
	return 0;
}

int strcmp(const char *src1, const char *src2) {
	for (; *src1 == *src2; src1++, src2++) {
		if (*src1 == '\0') {
			return 0;
		}
	}
	
	return *src1 - *src2;
}