![]() |
|
#1
|
|||
|
|||
vector probhey guys im new here, ive got a prog prob and need to know what im missing here:
ive got a vector of type struct, and i want to read in from a file. so lets say CPP / C++ / C Code:
and i want to read from a file that has only 2 words per index of the vector ie. input file= animal cat plant rose car ford etc... im gonna put it in a while loop but i cant figure out how to use the push_back function to fill the vector with the input... is it something like this? CPP / C++ / C Code:
where index is some int used to hold the size of the vector. do i need to use another method to fill this vector? thanx a bunch! |
|
#2
|
|||
|
|||
|
Code seems ok but try push_back() instead of pushback()
and I suggest not to use 'struct' but 'class' (but that's not really important here) |
Recent GIDBlog
Python ebook by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The