Question: Modify the program 1 2 - 1 0 from pages 8 3 9 as follows: 1 . Add a third C - string as name

Modify the program 12-10 from pages 839 as follows:
1. Add a third C-string as name3[NAME_LENGHT].
2. Add a pair of cout/cin.getline() for the third string similar to the ones for first and second strings.
3. Add the appropriate case to the "if/else if" structure such that the three strings will be displayed in alphabetical order.
Hint: There are 6 possible cases (3!,3 factorial =3*2*1=6) for all complete permutations. The easiest way to test is to input the three strings as single letters like: "a","b", and "c". Your "if/else if" condition check should cover all 6 cases for the possible input order like: abc, acb, bac, bca, cab, cba. Regardless of the input order the output should be always abc.
First "if" condition check is like:
if ( strcmp(name1,name2)0 && strcmp(name2,name3)0)
cout name1"" name2"" name3 endl;
else if ( strcmp(...
You have to complete the rest of the 5 "else if" condition. The last "else" can be used to display the message that all three strings are the same.
 Modify the program 12-10 from pages 839 as follows: 1. Add

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!