Mega Code Archive

 
Categories / C++ Tutorial / Vector
 

Instantiate a vector with 4 elements, each initialized to 90

#include <vector> #include <iostream> int main () {     using namespace std;     // Instantiate a vector with 4 elements, each initialized to 90     vector <int> v (4, 90);     vector <int>::iterator i;     for ( i = v.begin (); i != v.end (); ++ i ){         cout << *i << ' ';     }     return 0; }