#include <iostream>
#include <vector>
int main()
{
// Create a vector containing integers
std::vector<int> v = { 7, 5, 16, 8 };
// Add two more integers to vector
v.push_back(25);
v.push_back(13);
// Print out the vector
std::cout << "v = { ";
for (int n : v) {
std::cout << n << ", ";
}
std::cout << "};
";
}
// Create an empty vector
vector<int> vect;
// Create a vector of size n with all values as 10.
vector<int> vect(n, 10);
//initilize with values
vector<int> vect{ 10, 20, 30 };
//initilize with old array
vector<int> vect(arr, arr + n);
//initilize with old vector
vector<int> vect2(vect1.begin(), vect1.end());
#include <iostream>
#include <vector>
using namespace std;
int main()
{
// Create a vector containing integers
vector<int> v = { 7, 5, 16, 8 };
v.push_back(25); // Adds 25 to the contents of the vector
v.push_back(13); // Adds 13 to the contents of the vector
// Print out the contents of the vector
cout << "v = { ";
for (int n : v) {
std::cout << n << ", ";
}
cout << "};
";
}
vector <int> vc;
#include <iostream>
#include <vector>
using namespace std;
int main(){
vector<int> v1 ={1,2,3,4,5};
vector<int> v2{1,2,3,4};
vector<int> v3(4,11);
cout << "vector1" <<" ";
for(int i:v1){
cout << i << " ";
}
for(int i:v1){
cout << i << " ";
}
for(int i:v1){
cout << i << " ";
}
}
hi it's me