CPP/Strings/Concatenate

From ProgrammingExamples
< CPP
Revision as of 09:31, 2 February 2011 by Daviddoria (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Concatenate.cpp

#include <iostream>
#include <string>
 
int main()
{
  std::string string1 = "Hello";
  string string2 = "World";
 
  // Concatenate strings together using the operator +
  string full = string1 + " " + string2;
 
  std::cout << full << std::endl;
  return 0;
}