Nicolas, Quite a progress since your last post, I must say!!
Itâs a âProgrammer to Programmerâ forum but at this point I donât see any problem chipping in helping you out.
Looking at the code, however, I can say the program has a few problems
and must not be compiling error free.
1 Remove one of the two definitions of main, the first one is not making much sense
2 extra curly braces lying about like the one in search_book function.
For searching you need to structure your storage to make it more manageable.
One of the ways is to index the users and books entries based on their IDs an ISBNs respectively.
U can leave the user storage file and book storage files pretty much the way they are with a little change here there may be. Just make an index file atop for each of them and your searching problem will be solved. This design is clean, resource friendly, gives good performance and highly scalable.
Other way would be to go with the current design only, and load the whole file in some data structure and perform the search in that data structure only. Once the file is loaded, the program would perform reasonably well (based on the configuration of the comp, off course) but will take time to load itself. Not a clean design, scalability ânot an issue, but is resource hungry.
And yes, your classmate can use some help, so help him.
Regards
Ankur Verma
|