I have a program evaluating a straight hand in poker: Here is my code:
Code:
int numInRank[14];

cin.get(rankCh);
    switch (toupper(rankCh))
     {
      case '-1':            exit(0);
      case '?':           rank = 0; break;
      case 'A':          rank = 1; break;
      case '2':           rank = 2; break;
      case '3':           rank = 3; break;
      case '4':           rank = 4; break;
      case '5':           rank = 5; break;
      case '6':           rank = 6; break;
      case '7':           rank = 7; break;
      case '8':           rank = 8; break;
      case '9':           rank = 9; break;
      case 'T':           rank = 10; break;
      case 'J':           rank = 11; break;
      case 'Q':          rank = 12; break;
      case 'K':          rank = 13; break;

bool isStraight(int numInRank[]){
    int count = 0;
    for(int i = 1; i  < 14; i++){
        if(numInRank[i] != 0){
            count++;
            if(i == 13 && numInRank[1] != 0) count++;
        }else{
            count = 0;
        }
        if(count == 5) return true;
    }
    return false;
}
I would like to modify the above code to handle A high and A low straights- I sized my array to 14 instead of 13 to hold both...
Any suggestions...

Last edited by shabbir; 29Jul2007 at 10:11.. Reason: Code block - http://www.go4expert.com/forums/misc.php?do=bbcode#code