C++ examples for STL:string
Using the string literal as an argument to create string objects
#include <iostream> #include <string> using namespace std; int main()// w w w.j ava 2 s. c o m { // using the string literal passed as an argument. string str1("Alpha"); string str2("Beta"); string str3("Gamma"); string str4; // Output a string via cout. cout << "Here are the original strings:\n"; cout << " str1: " << str1 << endl; cout << " str2: " << str2 << endl; cout << " str3: " << str3 << "\n\n"; return 0; }