back( ) function in vector

Suman Barik
0

// CPP program to illustrate

// Implementation of back() function

#include <iostream>

#include <vector>

using namespace std;


int main()

{

vector<int> myvector;

myvector.push_back(3);

myvector.push_back(4);

myvector.push_back(1);

myvector.push_back(7);

myvector.push_back(2);

// Vector becomes 3, 4, 1, 7, 2


cout << myvector.back();

return 0;

}


Post a Comment

0Comments
Post a Comment (0)