Introduction Consider the string library function strcmp (s, t). In Java there is a similar method string.compareTo (s). This function determines if s lexicographically precedes t (i.e., if s appears earlier than t in dictionary). It does so by comparing the two strings character by Specification Implement your version of strcmp, called my_strcmp, which does the same comparison. Implementation Download file lab4strcmp.c. This program reads two strings from the user, calls library function strcmp to compare their lexicographical ordering, and then calls function my_stremp to compare the lexicographic ordering again. The program terminates when user enters two xxx. Implement function int my_strcmp (char []). Obviously, the function should not call library function strcmp. Note that your function doesn't have to return exactly the same value as strcmp -- it needs to return a value that has the same sign as those returned by strcmp. Complete the while loop so that it keeps on prompting user for inputs, and terminates when both two input strings are xxx, as shown in the sample output. Use function strcmp or my_strcmp to check. Sample input and output red 118 % a.out apple beast strcmp: "apple" appears earlier in dictionary than "beast" mystrcmp: "apple" appears earlier in dictionary than "beast" ace ave strcmp : "ace" appears earlier in dictionary than "ave" mystrcmp: "ace" appears earlier in dictionary than "ave" exit exam strcmp: "exit" appears later in dictionary than "exam" mystrcmp: "exit" appears later in dictionary than "exam" exam exam "exam" and "exam" are same "exam" and "exam" are same exam examine strcmp: exam" mystrcmp: "exam" appears earlier in dictionary than "examine" appears earlier in dictionary than "examine" examination exam strcmp: "examination" appears later in dictionary than "exam" mystrcmp: "examination" appears later in dictionary than "exam" xxx hello strcmp: "xxx" appears later in dictionary than "hello" mystrcmp: "xxx" appears later in dictionary than "hello" xxx XXX red 119 % #include
#include #define SIZE 30 int main() { char a[SIZE); char b[SIZE); scanf("s", a); scanf("s",b); while int resu- strcmp(a,b); if (resu 0) printf("stramp: \"\" appears later in dictionary than \":\" ", a,b); else printf("\"\' and \"\" are same ", a, b); int resu2 - my_strcmp(a,b); if (resu2 0) printf("mystrcmp: "88" appears later in dictionary than \"\" ", a,b); else printf("\"os\" and "#s\" are same ", a,b); int my_strcmp(char all, char b){