stuck how to use class/struct

i have project where im suppose to do this http://www.cs.panam.edu/~chen/cs2380/2380/hw/hw2380-1.pdf i can get it work fine if i put all the student stuff in one class/struct, and in this project im require to have four classes and im really confused can someone point me in right direction with where to begin. i would attach my code of how i have it setup but there are 5 header files and cpp files. to many to attach. any help would be appreciated.
Where are you having trouble?
trouble im having is don't know at what point should i read the file into array and also how to read all those different classes in to readList array.
Pen and paper are my best friends when it comes to planning.
I write down exactly what I need to accomplish, I start writing where the program begins and the steps it's going to go through to get to the end result, while doing this I end up asking myself a ton of questions which I also write down. Things like "What if the user enters the wrong filename here? What should happen?" and "What happens when this file closes, should I process after or as I read in each line?"

edit:
These questions I ask myself end up dictating most of the program flow/design, and also leads to early bug development.
Much like TDD (test driven development) only your going over the tests to fail in your head and on paper before any coding takes place.


You are required to design four classes:
nameType, dateType, personType and studentType
in respective header files
nameType.h, dateType.h, personType.h and studentType.h


That's quite an annoying restriction, but really this is probably what you should do anyway if designing it for yourself.


In the implementation of those functions, you need to use the overloaded stream insertion operator (<<)
and extraction operator for studenType.


I'm not sure if that means you need to define an overloaded operator or just use "the insertion operators", you will know better than me, but I'm guessing that you need to read each line in the file and store in each subsequent array element.

Simple Answer: I'd read the file in when you need to use it.
Last edited on
Topic archived. No new replies allowed.