vendredi 6 décembre 2019

How to call a variable from the main method in c programming?

I'm trying to make a poker game that counts the number of reds and blacks in the hand and prints "Flush" if either one is equal to 5. However, I have this if statement in another function as the actual calculation for the red and black variables are in the main method. How would I call the calculations from the main method into this other function? (all variables are defined outside of the method or were left out in the main method) '''

int main()
{
   for (int c = 0;c<2;c++)
           {
               redsum += suitsInHand2[c];
           }
       for (int v = 2;v<4;v++)
           {
                blacksum += suitsInHand2[v];
           }
   }
void analyzeHand()
    {
        if(redsum = 5)
            {
                printf("FLUSH");
            }
        if(blacksum = 5)
            {
                printf("FLUSH");
            }
    }

'''

Aucun commentaire:

Enregistrer un commentaire