how to add two strings without using + operator in cpp code example

Example 1: how to merge string array in C++

For string concatenation in C++, you should use the + operator. std::string nametext = "Your name is " + name; where operator + serves to concatenate strings. nametext is an std::string but these do not have the stream insertion operator ( << ) like output streams do.

Example 2: how to concatenate two big strings without using strcat in c++

cin >> doubleNumber;
cin.ignore();  //ignores an end of line character 
getline(cin, stringName);

Tags:

Cpp Example