Wednesday, February 11, 2015

C++ Tutorial for Beginners 44 - C++ Vectors

2:30 PM









1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#include <iostream>
#include <vector>
#include <algorithm> // std::remove
using namespace std;

int main()
{
std::vector<int> my_vec;
my_vec.push_back(10);
my_vec.push_back(20);
my_vec.push_back(30);
my_vec.push_back(40);

cout << "vector size = "<< my_vec.size() << endl;

for (int i=0;i< my_vec.size();i++)
cout << "vector " <<i <<" "<< my_vec.at(i) << endl;

///my_vec.erase(my_vec.begin() + 3);
/// my_vec.erase(std::remove(my_vec.begin(),my_vec.end(),30),my_vec.end());
/// my_vec.clear();
cout << endl<< endl;
//my_vec.resize();
cout << "is vector empty = "<< my_vec.empty() << endl;

for (int i=0;i< my_vec.size();i++)
cout << "vector " <<i <<" "<< my_vec.at(i) << endl;

return 0;
}




















vector::vector - C++ Reference

C++ Tutorial: A Beginner's Guide to std::vector

The STL Vector Class

Searches related to c++ vector

Sequence container (C++)

c++ vector initialization

c++ vector to array

c++ vector of pointers

c++ vector assign

c++ vector contains

c++ vector example

c++ vector of objects

c++ vector push_bac





C++ , STANDARD TEMPLATE LIBRARY (STL)

C++ STL ( Standard Template Library) Tutorial - Learning C++ in simple and easy steps : A beginner's tutorial containing complete knowledge of C++ Syntax Object Oriented Language, Methods, Overriding, Inheritance, Polymorphism, Interfaces, STL, Iterators, Algorithms, Exception Handling, Overloading,Templates, Namespaces and Signal Handling

Written by

We are one of the initiators of the development of information technology in understanding the need for a solution that is familiar and close to us.

0 comments:

Post a Comment

 

© 2013 Klick Dev. All rights resevered.

Back To Top