In this program, you are to prompt for and read two
strings from the user. Your program must then display a message saying which string is
longer (and by how much) or if they are the same length. It must then say which string
comes first alphabetically or if they are equal.
Allow the user to repeat the process - and watch out for cin
>> followed by cin.getline( )...
A sample dialog is as follows (with bold values indicating user entries):
---------------------------------------------
Enter string 1: Today is Monday
Enter string 2: Yesterday was Sunday
String 2 is 5 characters longer than string 1
String 1 comes first alphabetically
Again? (Y/N) y
---------------------------------------------
Enter string 1: I hate Mondays
Enter string 2: I hate Mondays
The strings are the same length
The strings are equal
Again? (Y/N) n
Processing Notes:
You will need two character arrays (one for each string).
Use the strlen( ) function whenever you need
to determine the length of a string.
Use the strcmp( ) function to compare the two
strings when determining which comes first alphabetically.
You may use either a while or do-while
to control the outer loop of the main( ) function.
|