string.size() : string size « String « C++






string.size()

string.size()
 
 

#include <iostream>
#include <string>
#include <algorithm>
using namespace std;

int main()
{
  string str1("Strings handling is easy in C++");
  string::iterator p;
  unsigned int i;

  // use size()
  for(i=0; i<str1.size(); i++)
    cout << str1[i];
  cout << endl;


  return 0;
}

/* 
Strings handling is easy in C++

 */        
  








Related examples in the same category

1.Use string.length() to check the string's size
2.string size grows
3.string.size(), string.length, string.capacity(), string.max_size()