-1

I want to know how I can declare a string from multiple string variables.

Example code:

std::string one = "one1";
std::string two = "two2";
std::string three = "three3";

std::string OneTwoThree = (one, " ", two, " ", three); // Here I want to save it as "one1 two2 three3"
std::cout << OneTwoThree;

Any help is really appreciated!

JohnJameson
  • 81
  • 1
  • 12

1 Answers1

0

You can do it by adding all three strings as

std::string OneTwoThree = one+" "+two+" "+three;