In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-14 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly explains "how to understand the usage of C++ vector array". Interested friends may wish to have a look at it. The method introduced in this paper is simple, fast and practical. Now let the editor take you to learn how to understand the usage of C++ vector array.
Catalogue
What is the vector array
Second, the basic operation of vector
Initialization of vector array
Insert elements into vector
Delete element
Ergodic array
Using vector to create dynamic two-dimensional array
What is the vector array
Vector is a vector type
A vector array is a dynamic array that can hold any data type.
Similar to ordinary arrays, elements in an array can be referenced by subscript
Second, the basic operation of vector
To use the vector array, add # include to the header file
Declaration of the vector array
Vector vec;// declares the initialization vector vec of an int-type vector vector array (1); / the content in vec is 1p2, 3pyrrine, 4pyrrine, 5vector vec (a); / / declares and initializes the vec vector int a [5] with a vector; vector vec (arecovery5); / / initializes the vector vec with elements of array a (& a [1], & a [4]). / insert an element in the range of a [1]-a [4] into the vector as the initial value of vec / / insert a new element vec.push_back (1) at the end of the vector; / / insert a new element vector::iterator it;it=vec.begin () in front of the iterator; vec.insert (it,5); / / insert a new element in front of the first element / add 3 1 elements to the vector while removing the previous element vec.assign / / now there are only three 1s in the vector to delete the element / / delete the last element vec.pop_back (); / delete the element vec.erase (vec.begin ()) at the specified location; / / delete the element value at the first location / / clear all elements vec,clear (); / / determine whether the array is empty vec.empty (); traverse the array / / use the subscript to access the vector aposition for (int item0bot I) like the array
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.