/* File: compare.c Examples of string comparison. */ #include #include #include "genlib.h" #include "simpio.h" #include "strlib.h" main() { string str1, str2 ; int result ; printf("Enter first string: ") ; str1 = GetLine() ; printf("Enter second string: ") ; str2 = GetLine() ; result = StringCompare(str1,str2) ; if (result == 0) { printf("The strings are the same\n") ; } else if ( result < 0 ) { printf("First string comes before second\n") ; } else { printf("Second string comes before first\n") ; } }