Unlike in other languages, strings in C++ are mutable, meaning the characters can be changed freely, using indices and the bracket notation:
string message = "Hello world!";
message[5] = '_';
message[6] = 'W';
cout << message; // Output: Hello_World!
Assignment
Follow the Coding Tutorial and let's update some strings!
Hint
Look at the examples above if you get stuck.
Free plan: 30 tutor messages. PRO is unlimited.
Saved
Ctrl + Enter to check
