Lesson 12 of 24

The string Class and String Problems

10 min 30 XP

C++ strings come with length(), substr(pos, len), find(), replace(), += to append and == to compare. reverse(s.begin(), s.end()) flips a string.

Example: edit me and press Run

Output Loading C++ (first time takes a few seconds)
Press Run to see the result here.

Challenge

+30 XP

Read a line with getline. Capitalise the first letter of every word and make the rest lowercase. Input: lEARN c++ AT skill park Output: Learn C++ At Skill Park

Output Loading C++ (first time takes a few seconds)
Press Run to see the result here.