
- C++ Basics
- C++ Home
- C++ Overview
- C++ Environment Setup
- C++ Basic Syntax
- C++ Comments
- C++ Data Types
- C++ Variable Types
- C++ Variable Scope
- C++ Constants/Literals
- C++ Modifier Types
- C++ Storage Classes
- C++ Operators
- C++ Loop Types
- C++ Decision Making
- C++ Functions
- C++ Numbers
- C++ Arrays
- C++ Strings
- C++ Pointers
- C++ References
- C++ Date & Time
- C++ Basic Input/Output
- C++ Data Structures
- C++ Object Oriented
- C++ Classes & Objects
- C++ Inheritance
- C++ Overloading
- C++ Polymorphism
- C++ Abstraction
- C++ Encapsulation
- C++ Interfaces
How to concatenate multiple C++ strings on one line?
Here we will see how to concatenate multiple strings in one line in C++. There are few different methods to do that. The easiest method is by using the plus (+) operator. The strings can be concatenated using +. We can place + sign between two strings to make them concatenated.
Input: Some strings “str1”, “str2”, “str3” Output: Concatenated string “str1str2str3”
Algorithm
Step 1: Take some strings Step 2: Concatenate them by placing + sign between them Step 3: Display the string Step 4: End
Example Code
#include <iostream> using namespace std; int main() { string str1, str2, str3; str1 = "Hello"; str2 = "C++"; str3 = "World"; string res = str1 + str2 + str3; cout << res; }
Output
HelloC++World
- Related Articles
- Concatenate Multiple Strings in Java.
- How to write multiple line strings using Bash with variables on Linux?
- How to concatenate strings in R?
- How to concatenate two strings using Java?
- How to concatenate several strings in JavaScript?
- How to concatenate two strings in C#?
- How to concatenate two strings in Python?
- How to correctly concatenate strings in Kotlin?
- How to concatenate two strings in Golang?
- How to split strings on multiple delimiters with Python?
- How to concatenate multiple string variables in JavaScript?
- C++ Program to Concatenate Two Strings
- How to display multiple labels in one line with Python Tkinter?
- Concatenate strings in Arduino
- How to Join Multiple Lines Into One on Linux

Advertisements