Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

C++ Vector Initialization method 02

#include <iostream>
#include <vector>
using namespace std;

int main() {
    
  // uniform initialization
  vector<int> vect{1, 2, 3, 4, 5};
  
  cout << "vector = ";

  // ranged loop
  for (const int& i : vect) {
    cout << i << "  ";
  }
  
  return 0;
}
Source by softhunt.net #
 
PREVIOUS NEXT
Tagged: #Vector #Initialization #method
ADD COMMENT
Topic
Name
7+1 =