/* STL : Vector [6] (erase, insert, swap) Author : Tausiq B.Sc in CTE (Studying) United International University */ #include #include using namespace std; int main () { vector v (5); for ( int i = 0; i < 5; i++ ) v [i] = i * 2; // 0 2 4 6 8 vector … Continue reading STL : Vector [6] (erase, insert, swap)
Tag: STL : vector
STL : Vector [5] (empty, pop_back)
/* STL : Vector [5] (empty, pop_back) Author : Tausiq B.Sc in CTE (Studying) United International University */ #include #include using namespace std; int main () { vector v (5); for ( int i = 0; i < 5; i++ ) v [i] = i * 2; for ( int i = 0; i < … Continue reading STL : Vector [5] (empty, pop_back)
STL : Vector [4] (begin, end)
/* STL : Vector [4] (begin, end) Author : Tausiq B.Sc in CTE (Studying) United International University */ #include #include using namespace std; int main () { vector v (5, 1); /* makes a vector of length 5 and fill the vector with value 1 */ vector :: iterator i; /* iterator i works like … Continue reading STL : Vector [4] (begin, end)
STL : Vector [3] (begin, size, clear)
/* STL : Vector [3] (begin, size, clear) Author : Tausiq */ #include #include using namespace std; int main () { vector v; int i; for ( i = 10; i < 50; i += 10 ) v.push_back ( i ); // 10 20 30 40 printf ("begin : %d\n", *v.begin () ); printf ("size … Continue reading STL : Vector [3] (begin, size, clear)
STL : Vector [2] (push_back, at, back, front)
/* STL : Vector [2] (push_back, at, back, front) Author : Tausiq B.Sc in CTE United International University */ #include "stdio.h" #include "vector" using namespace std; int main () { vector v; int i; for ( i = 0; i < 5; i++ ) v.push_back ( i + 65 ); for ( i = 0; … Continue reading STL : Vector [2] (push_back, at, back, front)
STL : Vector [1] (Introduction)
:: Vector :: ( Introduction ) ::
STL : find ()
If the value of key is equals to: 2 / 4 / 6 / 8 / 10 output will be found. vector <int>:: iterator p; declares a variable p, that traverse the whole vector form begin to end. p saves the address of key, if found. So, If (*p is equals to key) then, output: … Continue reading STL : find ()