+ 2
Hi all. Im trying to convert a string to uppercase but the code doesnt run. Here's what i did:
9 Answers
+ 3
https://code.sololearn.com/c2RdXaYviz9Z/?ref=app
+ 3
this one is the solution.
+ 2
change the call to toupper into a lambda:
transform(s.begin(), s.end(), s.begin(), [](char c) {
return toupper(c);
});
+ 1
Thanks it worked very well
@Raj can I ask why .begin() is included twice
+ 1
sorry but I am not so good at explanation ....
I can only make codes can't explain it....
+ 1
cool. thanks
+ 1
sorry once again
+ 1
the second begin() is used to identify the beginning of the destination container or vector. In STL, vector, list, deque these are called containers in general term.
Here, the source container is used as the destination container as well; however, we could have used a different container to store the uppercase letters.
0
thank you a lot