[英]How does one display search results for multiple vectors? C++
假設用戶在向量中搜索某個數字(vector number();),那么如何顯示該vector [i]的結果以及其他vector中的對應[i]?
請考慮為此使用迭代器 。
for(yourVector<YOUR_OBJECT_TYPE>::iterator it = yourVector.begin(); it != yourVector.end(); it++)
if(it == indexOfDesiredElement) {
YOUR_OBJECT_TYPE theValue = *it;
// pass theValue to a helper method and proceed from there.
}
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.