5 Topics

Member Avatar for
Member Avatar for hamzabinamin

We were given a task to use lists and iterators. We were supposed to make them from scratch. I'm done with that. The problems that I'm having are as following: 1. I'm not able to access the list made of Course datatype which is present in each Student instance. Does …

Member Avatar for StuXYZ
0
208
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 ihatehippies

I'm doing some research to determine the most efficient way to copy files. I've got 3 candidate functions: #1 [CODE=python] # uses generator to load segments to memory def copy(src, dst, iteration=1000): for x in xrange(iteration): def _write(filesrc, filedst): filegen = iter(lambda: filesrc.read(16384),"") try: while True: filedst.write(filegen.next()) except StopIteration: pass …

Member Avatar for ihatehippies
0
6K
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.