Skip to content

Instantly share code, notes, and snippets.

@vbuterin2
Created September 24, 2020 14:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vbuterin2/511f17c7c051fae58cd8317ff4351efa to your computer and use it in GitHub Desktop.
Save vbuterin2/511f17c7c051fae58cd8317ff4351efa to your computer and use it in GitHub Desktop.
// vector::push_back
#include <iostream>
#include <vector>
int main()
{
std::vector<int> my_vector;
int my_int;
std::cout << "Please enter some integer (enter 0 to end): \n";
do {
std::cin >> my_int;
my_vector.push_back(my_int);
} while (my_int);
std::cout << "my vector stores " << int(my_vector.size()) << " numbers. \n";
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment