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

📄 chapter6-10.cpp

📁 STL程序员开发指南源码
💻 CPP
字号:
//文件名:CHAPTER6-10.cpp
#pragma warning(disable:4786)
#include <iostream>
#include <vector>
using namespace std ;
typedef vector<int> INTVECTOR; //定义了一个宏
void main()
{
    INTVECTOR thevector; //定义一个vector变量
    INTVECTOR::iterator theIterator; //采用迭代器技术
    thevector.push_back(42) ; //插入一个元素值为42的元素到vector末尾中
    thevector.push_back(1) ; //插入一个元素值为1的元素到vector末尾中
    thevector.push_back(109) ; //插入一个元素值为109的元素到vector末尾中
    thevector.pop_back();  //删除109
    cout << "thevector [ " ;
    for (theIterator = thevector.begin(); theIterator != thevector.end();theIterator++)  //打印结果
    {  cout << *theIterator; if (theIterator != thevector.end()-1) cout << ", "; }
    cout << " ]" << endl ;
}

⌨️ 快捷键说明

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