3 Solved Topics

Remove Filter
Member Avatar for
Member Avatar for toneranger

Hi, Imagine a vector of structures with each structure containing various variables. struct Data { double x double y double z } vector<Data> Dataset vector<Data>::iterator it //input some data from a file into DataSet How can I iterate over this vector, comparing say, x at the nth row to the …

Member Avatar for toneranger
0
304
Member Avatar for sergent

I decided to learn C++ STL and I was exprimenting with STL containers. I saw this example [here](http://www.cplusplus.com/reference/stl/vector/insert/): // inserting into a vector #include <iostream> #include <vector> using namespace std; int main () { vector<int> myvector (3,100); vector<int>::iterator it; it = myvector.begin(); it = myvector.insert ( it , 200 ); …

Member Avatar for sergent
0
338
Member Avatar for Skyelher

[CODE]TreeSet goodWords = new TreeSet(); ... Iterator iterGoodWords = goodWords.iterator(); while (iterGoodWords.hasnext()) { String word = iterGoodWords.next(); System.out.println(word); }[/CODE] Tell me, why doesn’t that print anything even if there are some items in the goodWords collection? I know there are items in the set because when I check the size, …

Member Avatar for Skyelher
0
169

The End.