stringtest2.cpp
Upload User: gtl068a
Upload Date: 2007-01-25
Package Size: 233k
Code Size: 0k
Development Platform:

Visual C++

  1. // stringtest2.cpp
  2. #include <string>
  3. #include <iostream>
  4. using namespace std;
  5. int main(int argc, char** argv)
  6. {
  7.   string str1 = "Hello";
  8.   string str2 = "World";
  9.   string str3 = str1 + " " + str2;
  10.   cout << "str1 is " << str1 << endl;
  11.   cout << "str2 is " << str2 << endl;
  12.   cout << "str3 is " << str3 << endl;
  13.   if (str3 == "Hello World") {
  14.     cout << "str3 is what it should be" << endl;
  15.   } else {
  16.     cout << "hmmm... str3 isn't what it should be" << endl;
  17.   }
  18.   return 0;
  19. }