Do something like
#include <string> // ... std::string s( "February " ); s += std::to_string( day );
Here is a demonstrative program
#include <iostream> #include <string> int main() { std::string s( "February " ); int day = 20; s += std::to_string( day ); std::cout << s << '\n'; }
Its output is
February 20
Another approach is to use a string stream.
Here is one more demonstrative program.
#include <iostream> #include <sstream> #include <string> int main() { std::ostringstream oss; int day = 20; oss << "February " << day; std::string s = oss.str(); std::cout << s << '\n'; }
Its output is the same as shown above.
flagand it auto-added the comment.