Advertisement
Combreal

3DBoolVector.cpp

Apr 28th, 2019
301
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.91 KB | None | 0 0
  1. #include <iostream>
  2. #include <vector>
  3. using namespace std;
  4.  
  5. int main(void)
  6. {
  7.     vector < vector< vector<bool> > > buff;
  8.     for (int i = 0; i < 10; i++)
  9.     {
  10.         vector < vector<bool> > tempy;
  11.         for (int i = 0; i < 10; i++)
  12.         {
  13.             vector<bool> temp;
  14.             for (int j = 0; j < 10; j++)
  15.             {
  16.                 temp.push_back(true);
  17.             }
  18.             tempy.push_back(temp);
  19.         }
  20.         buff.push_back(tempy);
  21.     }
  22.     for (vector < vector<vector<bool> > >::iterator ht = buff.begin(); ht != buff.end(); ++ht)
  23.     {
  24.         cout << "New line --------> " << endl;
  25.         //it is now a pointer to a vector < vector<bool> >
  26.         for (vector<vector<bool> >::iterator it = ht->begin(); it != ht->end(); ++it)
  27.         {
  28.             //it is now a pointer to a vector<bool>
  29.             cout << "Value : ";
  30.             for (vector<bool>::iterator jt = it->begin(); jt != it->end(); ++jt)
  31.             {
  32.                 // jt is now a pointer to a boolean.
  33.                 cout << *jt;
  34.             }
  35.             cout << endl;
  36.         }
  37.     }
  38.     system("pause");
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement