How to Concatenate Multiple Strings in C++? Last Updated : 01 Mar, 2024 Comments Improve Suggest changes Like Article Like Report In C++, to concatenate multiple strings means we need to combine two or more strings into a single string. In this article, we will learn how to concatenate multiple strings in C++. Example Input: str1="Hello!" str2="Geek," str3="Happy Coding." Output: Hello! Geek, Happy Coding.Concatenate Multiple Strings in C++To concatenate multiple strings into a single string in C++, we can use the (+) plus operator that appends the additional string(s) to the original string as a result original string is modified. C++ Program to Concatenate Multiple StringsThe below example demonstrates the use of std::append() method to concatenate multiple string into one in C++. C++ // C++ Program to Concatenate Multiple Strings #include <iostream> #include <string> using namespace std; int main() { // initializing strings to string str1 = "Hello"; string str2 = " Geek!"; string str3 = " Happy Coding"; // concatenating multiple string using append() string concat_str = str1 + str2 + str3; // printing the string after concatenation cout << "Concatenated String: " << concat_str << endl; return 0; } OutputConcatenated String: Hello Geek! Happy Coding Time Complexity: O(N), where N is the total number of characters in the all the strings.Space Complexity: O(N) Note: We can concatenate two C-Style strings using strcat() function. Comment More infoAdvertise with us Next Article How to Concatenate Multiple Strings in C++? S subramanyasmgm Follow Improve Article Tags : C++ Programs C++ cpp-string CPP Examples Practice Tags : CPP Similar Reads How to Concatenate Multiple C++ Strings on One Line? In C++, strings are used to store a sequence of characters. The combination of multiple strings into a single one is called Concatenation. In this article, we will learn how to concatenate multiple strings in C++. Example Input: str1="Hello!"str2="Geek"str3="Welcome to GfG"Output:Hello! Geek Welcome 1 min read How to Concatenate Two Vectors in C++? Concatenation of two vectors refers to the process of adding the elements of one vector at the end of another vector. In this article, we will learn how to concatenate two vectors in C++.The simplest method to concatenate the two vectors is by using the vector insert() method. Letâs take a look at a 3 min read String Concatenation in C++ String concatenation refers to the process of combining two or more strings into a single string. Generally, one string is appended at the end of the other string.The simplest method to concatenate two strings in C++ is by using + operator. Let's take a look at an example:C++#include <bits/stdc++ 3 min read Concatenation of Two Strings String concatenation is the process of joining two strings end-to-end to form a single string.ExamplesInput: s1 = âHelloâ, s2 = âWorldâOutput: âHelloWorldâExplanation: Joining âHelloâ and âWorldâ results in âHelloWorldâ.Input: s1 = âGoodâ, s2 = âMorningâOutput: âGoodMorningâExplanation: Joining âGoo 4 min read How to Concatenate Two Arrays in C++? In C++, arrays store a fixed number of elements of the same type in contiguous memory locations. In this article, we will learn how to concatenate two arrays in C++. Example: Input: myArray1={10, 30, 40} myArray2 ={20, 50, 60}Output: Concatenated Array: 10 30 40 20 50 60 Concatenate Two Arrays in On 2 min read How to Handle Multiple String Inputs with Spaces in C++? In C++, strings are a sequence of characters that might contain spaces in many cases but we can read only the input text till whitespace using cin. In this article, we will learn how to handle multiple string inputs with spaces in C++. Example: Input:Enter multiple strings:String1String2Output:You E 2 min read How to Take Multiple Line String Input in C++? In C++, taking string input is a common practice but the cin is only able to read the input text till whitespace. In this article, we will discuss how to read the multiple line of text input in C++. For Example, Input:Enter Your Text: This is amultiline text.Output:You Have Entered:This is amultilin 2 min read How to Convert a Single Character to String in C++? A string is a generally made up of a sequence of multiple characters. In this article, we will learn how to convert a single character to a string in C++.Example:Input: c = 'A'Output: s = "a"Explanation: Character c is converted to a string.Input: c = '#'Output: s = "#"Explanation: Character c is co 4 min read How to Convert a std::string to char* in C++? In C++, strings are the textual data that is represented in two ways: std::string which is an object, and char* is a pointer to a character. In this article, we will learn how to convert a std::string to char* in C++. Example Input:string myString = "GeeksforGeeks";Output:char * myString = "Geeksfor 1 min read How to Create a Multimap of Vectors in C++? In C++, a multimap is similar to a map with the addition that multiple elements can have the same keys. Also, it is not required that the key-value and mapped value pair have to be unique in this case. In this article, we will learn how to create a multimap of vectors in C++. For Example, Input:myPa 2 min read Like