c++基础学习(13)--(STL、标准库)
生活随笔
收集整理的這篇文章主要介紹了
c++基础学习(13)--(STL、标准库)
小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
文章目錄
- 目錄
- 1. STL教程
- 2.標(biāo)準(zhǔn)庫
- 3.有用的資源
目錄
1. STL教程
#include <iostream> #include <vector> using namespace std;int main() {// 創(chuàng)建一個(gè)向量存儲(chǔ) intvector<int> vec; int i;// 顯示 vec 的原始大小cout << "vector size = " << vec.size() << endl;// 推入 5 個(gè)值到向量中for(i = 0; i < 5; i++){vec.push_back(i);}// 顯示 vec 擴(kuò)展后的大小cout << "extended vector size = " << vec.size() << endl;// 訪問向量中的 5 個(gè)值for(i = 0; i < 5; i++){cout << "value of vec [" << i << "] = " << vec[i] << endl;}// 使用迭代器 iterator 訪問值vector<int>::iterator v = vec.begin();while( v != vec.end()) {cout << "value of v = " << *v << endl;v++;}return 0; }2.標(biāo)準(zhǔn)庫
3.有用的資源
總結(jié)
以上是生活随笔為你收集整理的c++基础学习(13)--(STL、标准库)的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Python面试题-交换两个数字的三种方
- 下一篇: pandasStudyNoteBook