+ 5
Compare function of C++
How the answer is 5! https://www.sololearn.com/post/493902/?ref=app
5 Answers
+ 7
Position of the first character in theĀ compared string.
If this is greater than theĀ string length, it throwsĀ out_of_range.
Note: The first character is denoted by a value ofĀ 0Ā (notĀ 1).
len->Length ofĀ compared stringĀ (if the string is shorter, as many characters as possible).
A value ofĀ string::nposĀ indicates all characters until the end of the string.subpos, sublenSame asĀ posĀ andĀ lenĀ above, but for theĀ comparing string.
hope you understood
+ 2
I think it returns the length of their difference...
Well s2 - s1 results in 'learn' and it's length is 5.
+ 2
Compare means difference here I think so learn has 5 characters so 5 is answer maybešš»āāļø
+ 1
Answer is 5 because compare() will subtract the length of s1 from length of s2
0
Returns >0 when :
Either the value of the first character that does not match is greater in the compared string, or all compared characters match but the compared string is longer.