Question: Write a C++ program in a file called pp8a.cpp to ask the user for two words, then print them out in alphabetical order using strcmp.

Write a C++ program in a file called pp8a.cpp to ask the user for two words, then print them out in alphabetical order using strcmp.

 

) Execute your program and compare its output to the Expected Output column.

InputExpected Output
Enter hello for the first word and help for the second

Enter first word: hello

Enter second word: help

hello help

Enter help then   hello 

Enter first word: help

Enter second word: hello

hello help

Enter hello then hello

Enter first word: hello

Enter second word: hello

hello hello

Enter hello and HELLO

[Note how uppercase letters have a smaller ASCII value than lowercase letters]

Enter first word: hello

Enter second word: HELLO

HELLO hello


Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!