push_back( ) function in vector

Suman Barik
0

// CPP program to create an empty vector

// and push values one by one.

#include <iostream>

#include <vector>

using namespace std;


int main()

{

// Create an empty vector

vector<int> vect;


vect.push_back(10);

vect.push_back(20);

vect.push_back(30);


for (int x : vect)

cout << x << " ";


return 0;

}


Tags

Post a Comment

0Comments
Post a Comment (0)