Strings In Depth3 / 15
Up next

Concatenate

#include <print>
#include <string>

int main() {
    std::string a = "foo";
    std::string b = "bar";
    // + builds a new string; += appends in place
    std::string joined = a + b;
    joined += "!";
    std::println("{}", joined);
}
What you're solving

+ and += join strings