how to concatenate a string and an int c++

For C++, you need all the other important parts, such as the include files, and the namespace qualifiers.

Unlike most scripting languages, the programming statements and expressions have to be in the context of a function.

For example:

#include <iostream>
#include <string>

using std::cout;
using std::endl;
using std::string;

int main()
{
  int Age = 25;
  string name = "John";
  cout << Age << " " << name << endl;
  return 0;
}

Leave a Comment