CPP/Strings/Concatenate

From ProgrammingExamples
< CPP
Revision as of 00:32, 29 June 2010 by FirstPerson (Talk | contribs)

Jump to: navigation, search

Concatenate.cpp

#include <iostream>
#include <string>
#include <sstream>
 
using namespace std;
 
int main()
{
  string firstName = "jello";
  string middleName = "K.";
  string lastName = "mello";
 
  //concat strings together using the operator +
  string fullName = firstName + " " + middleName + " " + lastName;
 
  cout << fullName << endl;
  return 0;
}