Display the capacity of a string - C++ STL

C++ examples for STL:string

Description

Display the capacity of a string

Demo Code

#include <iostream>
#include <string>
using namespace std;
int main()//  www. j  av a2s . co m
{
   string str1("Alpha");
   string str2("Beta");
   string str3("Gamma");
   string str4;
   cout << "Capacity of str1: " << str1.capacity() << "\n\n";
   return 0;
}

Result


Related Tutorials