The function swaps the values of the string parameters if


Write a void function named sort2 that takes two string parameters and sorts them. The function swaps the values of the string parameters if the 1st string is lexicographically greater than the 2nd string and otherwise leaves the strings unchanged. For example:

string s1 = "Orange";

string s2 = "Apple";

sort2(s1, s2);      // now s1 is "Apple" and s2 is "orange"

Solution Preview :

Prepared by a verified Expert
Basic Computer Science: The function swaps the values of the string parameters if
Reference No:- TGS02797534

Now Priced at $10 (50% Discount)

Recommended (92%)

Rated (4.4/5)