append in cpp code example
Example 1: c++ append
Extends the string by appending additional characters at the end of its current value
Example 2: c++ append a char to a string
#include <iostream>
#include <string>
int main ()
{
std::string name ("John");
std::string family ("Smith");
name += " K. ";
name += family;
name += '\n';
std::cout << name;
return 0;
}
Example 3: appending string in c++
#include<iostream>
#include <string>
int main() {
std::string namee = "Caleb";
namee += " Hello";
std::cout << namee << std::endl;
std::string namee2 = std::string("Caleb")+" Hello";
std::cout << namee2 << std::endl;
std::cin.get();
}