Question & Answer: Using the two strings above, what will the following code display? if(strcmp(str1, str2) == 0) cout…..

Question 48 str1 t10 str2 do 9 O Using the two strings above, what will the following code display? L0 if( strcmp( str1 , str2) 0 ) cout << str1 <<is equal to << str2; cout << str1 <<is less than << str2; cout << str1 <<is greater than <<str2; else if ( strcmp( str1, str2) 0) else Selected Answer: b. cat is greater than dog

Using the two strings above, what will the following code display? if(strcmp(str1, str2) == 0) cout

Expert Answer

 

it should return <0 value more precisely it will return -1

so it goes into the second else if loop

so it will print “cat is less than dog” — this will be the answer

Still stressed from student homework?
Get quality assistance from academic writers!