Image

Imagemadbassist wrote in Imagecpp

Listens: Bob Dylan-"Joey"

String problems and a new project

Okay. Whenever I use the STL string instead of apstring that we use in my class to declare string objects, I'm getting problems. For some reason, my compiler (VC++6.0) won't recognize string as a datatype. I'll get a first error reading "'string' undeclared identifier" or sometimes, "'string' missing storage-class or type declarations" or something to that effect (on the program I'm doing right now I'm not getting it, so I can't tell you for sure).

New project in class! We have an alphabetized file of 348 names and scores. We need to read it in, and allow the user to input a name to look for, then perform a binary search to find the name and its corresponding score. I understand what a binary search is, but I'm unsure exactly how to use it. When I found the bsearch and binary_search functions though, he told me I have to do it without those, so all the finding needs to be done by code I write. Anyone have any tips?

Lastly, relating to that, what exactly are the bsearch and binary_search functions, and how are they used (arguments, what they return, etc.)?