*sob* why did I open my project again? WHY?
option 6 is broken. once you modify a record, you can’t find it. boo
I thought I had tested it, and I don’t know where the problem is…
*deep breath* it is over. move on…
*sob* why did I open my project again? WHY?
option 6 is broken. once you modify a record, you can’t find it. boo
I thought I had tested it, and I don’t know where the problem is…
*deep breath* it is over. move on…
cody reminded me I ought to mention this on here…
I’M FINISHED!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
*sigh*
now to stay up all night and move out…
MasterData methods left to write
- ModifyRecord
options working
- 1
- 2
- 3
- 4
- 5
![]()
MasterData methods left to write
- DeleteRecord
- ModifyRecord
options working
- 1
- 2
- 3
- 4
I am currently in the process of fixing my search. hopefully this works.
Thanks everyone for responding to my cry of help.
Especially Zac!
Even though I have been working almost nonstop for days, I am hardly making any progress.
My search is not working, and I can’t figure out how to fix it.
in option3:
- I create a master file on the heap.
- I initialize an SSN object (inSSN) with the user input
- I call my search in the following line:
int RecNo = masterFile->Search(inSSN);
- I declare a Person object, record, on the heap
- I call ReadRecord with the following line:
*record = masterFile->ReadRecord(RecNo);
- I call display(*record);
- I delete masterFile
in MasterData::Search
- I create two character arrays of 9 characters, fileSSN and searchSSN
- I copy the string from the SSN that was passed into the function into searchSSN using:
strcpy(searchSSN, inSSN.NoHyphens().c_str());
- (Note: I have tested these numbers, and the conversion works)
- I declare/initialize some integer variables:
int firstRec=RECSIZE, lastRec=(GetNumRecs()*RECSIZE), midRec, compare;
- I begin a while(true) loop
- I have the test statement:
if(firstRec > lastRec) {return 0;}
- I initialize midRec to (lastRec + firstRec)/2
- I move the read pointer to midRec:
file.seekg(midRec);
- I read from the file into fileSSN:
file.read(fileSSN, 9);
- Note: The above statement seems to be where the problem occurs. When I print fileSSN, it seems to be reading more than 9 characters. Then, my compare totally fails…
- I call file.flush();
- I compare the two char arrays:
compare = strcmp(searchSSN, fileSSN);
if(compare==0) {return midRec/RECSIZE;}
else if(compare < 0) {lastRec = (midRec - RECSIZE);}
else if(compare > 0) {firstRec = (midRec + RECSIZE);}
- I end my while loop
- I delete fileSSN and SearchSSN
What is wrong??? I can e-mail code if necessary. If someone will respond. please. :’(
I have just spent the most ridiculous amount of time trying to spot the simplest error ever.
On my search function, I forgot to actually name the SSN object I was passing in. Instead, I was just using SSN… wow. wow, wow, wow. *sigh*
I wish I would have been in the lab for this one. Someone would have caught it!
Since I have already written every function I need to write option 3 except Search and the actual display method, I will do those next, and then make option 3.
I want to work on my project, but my paper is due tomorrow! I also have to start studying for biology. This really sucks.
Option 2 now working!
I had a plus sign where I needed a *. This was a bit confusing, since it seemed to work for State…
Search & Sort are next on the agenda.