Answer to Question #252449 in C++ for joshua

Question #252449

Print the two strings, firstString and secondString, in alphabetical order. Assume the strings are lowercase. End with newline. Sample output:


1
Expert's answer
2021-10-18T06:44:51-0400
#include <stdio.h>
#include <string.h>

int main()
{
    char firstString[200], secondString[200];
    printf("Input first string:");
    scanf("%s", firstString);
    printf("Input second string:");
    scanf("%s", secondString);
    
    if (strcmp(firstString, secondString) < 0)
        printf("%s %s\n", firstString, secondString);
    else
        printf("%s %s\n", secondString, firstString);

    return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS