c++

How to Insert a New Element in an Array in C++ Using Vector Class Full Project For Beginners


 

Welcome folks today in this blog post we will be inserting a new element in an array in c++ using vector class All the full source code of the application is shown below.

 

 

 

 

 

 

In order to get started you need to make a app.cpp file and copy paste the following code

 

 

app.cpp

 

 

 

#include <iostream>
#include <vector>

using namespace std;

int main ()
{
  vector<int> myvector;
  for (int i=1; i<=5; i++)
   myvector.push_back(i);

  for (vector<int>::iterator it = myvector.begin() ; it != myvector.end(); ++it)
  cout << *it<<"n";

  return 0;
}

 

Similar Posts:

    None Found

Leave a Reply

Your email address will not be published. Required fields are marked *