How to Concatenate Multiple C++ Strings on One Line? Last Updated : 21 Apr, 2025 Comments Improve Suggest changes Like Article Like Report 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 to GfGConcatenate Multiple C++ Strings in One LineIn the std::string class, the '+' operator is overloaded to concatenate two strings. We can use this '+' operator of the std::string to concatenate multiple strings into a single line. C++ Program to Concatenate Multiple Strings in One Line C++ // C++ program to concatenate mutiple strings #include <iostream> #include <string> using namespace std; int main() { // Initialize sttings string s1 = "Hello!"; string s2 = " Geek"; string s3 = " Welcome to GfG"; // concatenate string using + operator string ans = s1 + s2 + s3; // printing concatenated string cout << "The Concatenated string is : " << ans << endl; return 0; } OutputThe Concatenated string is : Hello! Geek Welcome to GfG Time Complexity: O(N), where N is the total length of all the strings being concatenated.Auxiliary Space: O(N) We can also use strcat() and append() function to concatenate multiple strings. Comment More infoAdvertise with us Next Article Concatenation of Two Strings H harshsingh123 Follow Improve Article Tags : C++ Programs C++ cpp-string CPP Examples Practice Tags : CPP Similar Reads How to Concatenate Multiple Strings in C++? 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 2 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 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 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 Take Multiple String Inputs in a Single Line in C++? In C++, strings are used to store textual data. While working with user input, we often may need to take multiple string inputs in a single line only. In this article, we will learn how to take multiple string inputs in a single line. Example Input: Hi,Geek,Welcome,to,GfG delimiter = ',' Output: Str 2 min read Like