Answers for "initialize a std vector c++"

C++
4

c++ initialize a vector

#include <bits/stdc++.h> 
#include <vector> 
using namespace std; 
  
int main() 
{ 
// This vector initializes with the values: 10, 20, and 30
  vector<int> vect{ 10, 20, 30 }; 

    return 0; 
}
Posted by: Guest on April-26-2020
0

initialize vector c++

std::vector<int> ints;

ints.push_back(10);
ints.push_back(20);
ints.push_back(30);
Posted by: Guest on October-10-2021

Browse Popular Code Answers by Language