More C++ help, please!

Page 2 - Seeking answers? Join the AnandTech community: where nearly half-a-million members share solutions and discuss the latest tech.

notfred

Lifer
Feb 12, 2001
38,241
4
0


<< Cool... glad you got it working now! >>



Now I jsut need to make my FindWumpus function work correctly :)
 

Mucman

Diamond Member
Oct 10, 1999
7,246
1
0
Here we go again :)

I think the problem is here :

if(temp.get_name() == test){

I added the following couts to debug in the FindWumpus method:

cout << "temp.get_name() = " << temp.get_name() << " test = " << test << endl;
if(temp.get_name() == test){
cout << "test passed!\n";
return CurrentNode->GetWumpus();
}
cout << "Could not retreive a Wumpus\n";
return 0;
}
 

Mucman

Diamond Member
Oct 10, 1999
7,246
1
0
Change the if statement to this :

if(strcmp(test, temp.get_name() ) == 0 ) {

also add string.h to the include list
 

notfred

Lifer
Feb 12, 2001
38,241
4
0


<< Change the if statement to this :

if(strcmp(test, temp.get_name() ) == 0 ) {

also add string.h to the include list
>>



thank you :)


oh, and - you are better than me :)
 

Mucman

Diamond Member
Oct 10, 1999
7,246
1
0
LOL... no one is better than anyone... some people just have more experience :).

One tip : Always put in tons of couts to debug your code... It is tedious but it will actually save you time in the future...

good luck.