⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 chapter6-6.cpp

📁 STL程序员开发指南源码
💻 CPP
字号:
//文件名:CHAPTER6-6.cpp
#pragma warning(disable:4786)
#include <iostream>
#include <vector>
using namespace std ;
typedef vector<int> INTVECTOR;
void main()
{
    INTVECTOR thevector;
    thevector.push_back(42) ;
    cout << "thevector's size is: " << thevector.size() << endl;
    cout << "thevector's maximum size is: " << thevector.max_size()<< endl;
    cout << "thevector's capacity is: " << thevector.capacity() << endl;
    thevector.reserve(1000);
    cout << endl << "After reserving storage for 1000 elements:" << endl;
    cout << "thevector's size is: " << thevector.size() << endl;
    cout << "thevector's maximum size is: " << thevector.max_size()<< endl;
    cout << "thevector's capacity is: " << thevector.capacity() << endl;
    thevector.resize(2000);
    cout << endl << "After resizing storage to 2000 elements:" << endl;
    cout << "thevector's size is: " << thevector.size() << endl;
    cout << "thevector's maximum size is: " << thevector.max_size()<< endl;
    cout << "thevector's capacity is: " << thevector.capacity() << endl;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -