0
I don't know what's wrong with this code
As you can tell by looking at the code below, I'm trying to reverse the order of q string (user input) but it's adding some symbols on its own when executed .. I'm not sure if the problem is in the sololearn playground compiler or in the cin of c++ https://code.sololearn.com/clB8sT3ZMv5S/?ref=app
6 Answers
+ 3
There are two problems with the code. First, replace sizeof(ch) with ch.length(). Second, for loop should start with ch.length()-1, since ch is only valid from 0 to ch.length()-1.
+ 2
sizeof(ch) will not return the number of characters entered.
+ 1
~ swim ~ cool đ
0
Can anyone explain the difference between the size and length method ? Why did they make both methods do the same thing