vector<int> vec{3,4,5};
vector<int> vec{{3,4,5},{0,6}};
|
|
|
|
|
|
Creating a 2D vector with known elements: 3 4 5 0 6 Creating a 2D vector with known row and column sizes: 101 102 103 104 201 202 203 204 301 302 303 304 |
|
|
Creating a 3-dimensional vector 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 The filled 3D vector: 111 112 113 114 115 121 122 123 124 125 131 132 133 134 135 141 142 143 144 145 211 212 213 214 215 221 222 223 224 225 231 232 233 234 235 241 242 243 244 245 311 312 313 314 315 321 322 323 324 325 331 332 333 334 335 341 342 343 344 345 |
|
|
|
|
|
|
i need some correction |
{ {1,3,4}, 2, 3}
is mixing a vector<int> with individual int values into a a containing vector. All members of a vector must be of the same type.
|
|
|
|
|
|
std::vector<int> vec(12);
-- you will get 12 elements with the default value of zero for int. A blank string ("") if the type was std::string, etc.std::vector<int> vec(10, 42);
. 10 elements, all initialized to 42.
|
|
std::fill(v.begin(), v.end(), 0);
these line is possible?std::fill(v.begin(), v.end(), 0); thinking the 'v' is a multidimensional vector |
|
|
|
|
100 100 100 100 100 100 100 100 100 100 100 100 0 0 0 0 0 0 0 0 0 0 0 0 |
|
|
|
|
|
|