Write a function called abcOrder that determines the alphabetical order of one string compared to another string. The function should print out whether or not the first string comes before or after the second string, alphabetically. The function should print out that the two strings are identical if the same string is entered as the first string and the second string. Example Output Enter string 1: apple Enter string 2: orange The string "apple" come before "orange", alphabetically. Enter string 1: apple Enter string 2: apple The 2 strings that were entered are identical. Rubrics . • 1 point: Use scanf to read input. 3 points: Using the function. • 2 points: correct output. 4 points: No syntax errors

Respuesta :

To write a function called abcOrder that determines the alphabetical order of one string compared to another string.

What is a string?

A string is any sequence of characters that is literally interpreted by a script. Strings include phrases like "hello world" and "LKJH019283". As shown in the following example, a string is attached to a variable in computer programming.

In most programming languages, the string can either be all letters or all numbers (alphanumeric). Many languages support strings as numbers only, but they are frequently classified as integers if they are only numbers.

#include<stdio.h>

#include<string.h>

#include<stdlib.h>

void abcOrder(char *s1, char *s2)

{

    int cmp = strcmp(s1, s2);

    if(cmp == 0) {

        printf("The 2 string that were entered are identical\n");

    }

else if(cmp == 1) {

        printf("The string \"%s\" come before \"%s\"\n", s2, s1);

    }

else {

        printf("The string \"%s\" come before \"%s\"\n", s1, s2);

    }

}

int main() {

    char *s1 = (char *)malloc(100*sizeof(char));

    char *s2 = (char *)malloc(100*sizeof(char));

    printf("Enter string 1: ");

    scanf("%s", s1);

    printf("Enter string 2: ");

    scanf("%s", s2);

    abcOrder(s1, s2);

}

Learn more about Strings

https://brainly.com/question/25324400

#SPJ4