#include #include int strcmp(const char* s1, const char* s2) { for ( ; *s1 == *s2; ++s1, ++s2) { if (*s1 == '\0') { return 0; } } if (*s1 < *s2) { return -1; } else { return +1; } } main() { // Declaração de variaveis char x[20], y[20]; int cmp; printf("Insira duas strings\n"); gets(x); gets(y); cmp = strcmp(&x, &y); if(!cmp) printf("São iguais\n"); else if (cmp == 1) printf("A primeira string eh maior na ordem alfabetica"); else printf("A primeira string eh menor na ordem alfabetica"); getchar(); }