bvectr1.cpp

来自「vc学习的好的代码no.9 vc学习的好的代码no.9」· C++ 代码 · 共 32 行

CPP
32
字号
#include <iostream>
#include <vector>
#include <bitset>

using namespace std;

const ARRAY_SIZE = 0;

void main(void)
 {
   typedef vector<bool> bit_vector;
   typedef bit_vector::iterator index;

   bit_vector theVector(ARRAY_SIZE);

   // Intialize the array to contain the members [F, T, F, T]

   theVector.push_back(false);
   theVector.push_back(true);
   theVector.push_back(false);
   theVector.push_back(true);

   cout << "First element: " << theVector.front() << endl;
   cout << "Last element: " << theVector.back() << endl;

   cout << "Vector contents" << endl;

   for (index i = theVector.begin(); i < theVector.end(); i++)
     cout << *i << endl;

 }

⌨️ 快捷键说明

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