hey guys, I'm having a little bit of trouble with my code. it is s'pose to read the names and stats of basketball players from a file and store it in an individual structure. I can get the data into the structure but I dunno how to pass it to a function and read the data from there.
it gives me the errors:
main.cpp:134: error: request for member ‘first’ in ‘vStruct.std::vector<_Tp, _Alloc>::operator[] [with _Tp = Player*, _Alloc = std::allocator<Player*>](((long unsigned int)i))’, which is of non-class type ‘Player*’
main.cpp:134: error: request for member ‘last’ in ‘vStruct.std::vector<_Tp, _Alloc>::operator[] [with _Tp = Player*, _Alloc = std::allocator<Player*>](((long unsigned int)i))’, which is of non-class type ‘Player*’
It says right in the error code cout << vStruct[i].first << " " << vStruct[i].last << endl;
should be cout << vStruct[i]->first << " " << vStruct[i]->last << endl;
Because you are passing "vStruct" as a pointer, the compiler has to be told to dereference the data.
How on earth do you expect to remember what those variables stand for?
You're going to put this project down for a month and when you come back to it you'll be totally confused. Not to mention the difficulties anyone else will have if they try to look at your code.