Original Post
Hello, im getting raelly frustrated at this bug, i cant seem to figure out what im doing wrong. I recieve no compile errors however, when i run the following piece of code. Which is a member function of a class. I can only run it once, the second time irun it, the program exits after printing STUCK HERE hundreds of times. I figured the value_suit array was filled with true's hence jump to the else. SO i wrote a function which initializes all back to false after first running. value_suit is a global variable so its not like each card object requires the array to be re-initialized. I still get hundreds of STUCK HERE's (which i put there for debugging) and the program jumps out and quits. However even though this class is being used by another class which runs in a loop for about 20 times. So not only does it stop the execution of the program, it some how gets out of the loop without passing this point. Any and every bit of help will be very much appreciated. Here is the code of the member function causing the prob.
Card::card_checker(){
if (value_suit[possible_value][possible_suit] == false)
{
value_suit[possible_value][possible_suit]= true;
setValue(possible_value);
setSuit(possible_suit);
}
else
{
cout<<"STUCK HERE!!";
create_card();
return 0; //do not set the Value or Suit of Card
}
return 0;
};
I even tried commenting out the return 0; in the else clause, however it didnt fix anything. So i put it back for my program to run perfect each and everytime, but that aint happening atm.