concatenation string

I am trying to write a concatenation string to satisfy this requirement:

use string concatenation to connect a city name, state name, and zip code into one single string like this: city name followed by a comma, a space, state name, two spaces and ZIP code.

Can anyone help me??
cityName+", "+stateName+" "+zipCode;
If zipCode is not a string, you can use stringstream to convert it to one.
the string operators are overloaded so you can just add together strings with operator+

1
2
3
4
5
std::string cityName = "blah";
std::string stateName = "blahblah";
std::string zipCode = "blah123";

std::string output = cityName + ", " + stateName + "  " + zipCode;
Topic archived. No new replies allowed.