how do i combine 2 variables into a string?

This is a discussion on how do i combine 2 variables into a string? within the C++ Programming forums, part of the General Programming Boards category; like how would i take variable <<firstname and combine it with variable <<lastname to make <<fullname ?...

  1. #1
    PHP
    PHP is offline
    Registered User
    Join Date
    Nov 2002
    Posts
    41

    how do i combine 2 variables into a string?

    like how would i take variable <<firstname and combine it with variable <<lastname to make <<fullname ?
    In order of learned:
    HTML - Mastered
    CSS - Enough to use
    SSI - Mastered
    PHP - Advanced
    C/C++ - Current Project

  2. #2
    UNBANNED OneStiffRod's Avatar
    Join Date
    Jan 2002
    Posts
    669
    //create 2 strings

    string first = "first name";
    string last="last name";
    string combined=first+last;

    The + operator adds strings together. Most of your questions would be answered by picking up a C++ book at the library or reading the tutorials on this site.
    My Avatar says: "Stay in School"

    Rocco is the Boy!
    "SHUT YOUR LIPS..."

  3. #3
    PHP
    PHP is offline
    Registered User
    Join Date
    Nov 2002
    Posts
    41
    yeah, im getting a book on saturday but im just getting started tonight
    In order of learned:
    HTML - Mastered
    CSS - Enough to use
    SSI - Mastered
    PHP - Advanced
    C/C++ - Current Project

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. String Class
    By BKurosawa in forum C++ Programming
    Replies: 117
    Last Post: 08-09-2007, 01:02 AM
  2. Program using classes - keeps crashing
    By webren in forum C++ Programming
    Replies: 4
    Last Post: 09-16-2005, 03:58 PM
  3. Calculator + LinkedList
    By maro009 in forum C++ Programming
    Replies: 20
    Last Post: 05-17-2005, 12:56 PM
  4. Another overloading "<<" problem
    By alphaoide in forum C++ Programming
    Replies: 18
    Last Post: 09-30-2003, 10:32 AM
  5. "Operator must be a member function..." (Error)
    By Magos in forum C++ Programming
    Replies: 16
    Last Post: 10-28-2002, 01:54 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21