topical media & game development

talk show tell print

professional-program-01-stringtest2-stringtest2.c

? / professional-program-01-stringtest2-stringtest2.c


  // stringtest2.cpp
  
  include <string>
  include <iostream>
  
  using namespace std;
  
  int main(int argc, char** argv)
  {
    string str1 = "Hello";
    string str2 = "World";
    string str3 = str1 + " " + str2;
  
    cout << "str1 is " << str1 << endl;
    cout << "str2 is " << str2 << endl;
    cout << "str3 is " << str3 << endl;
  
    if (str3 == "Hello World") {
      cout << "str3 is what it should be" << endl;
    } else {
      cout << "hmmm... str3 isn't what it should be" << endl;
    }
  
    return 0;
  }
  


(C) Æliens 20/2/2008

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.