C++ examples for STL:string
Display the size of a string
#include <iostream> #include <string> using namespace std; int main()/* w w w . j a v a2 s . com*/ { string str1("Alpha"); string str2("Beta"); string str3("Gamma"); string str4; cout << "str1 contains " << str1.size() << " characters.\n"; return 0; }