exercises/ex01/cards.c
int count_change(int val) {

   if ((val >= 2) && (val <= 6)) {
      /* Low cards add one to the count */
      return 1;
   } else if ((val == 10) || (val == 11)) {
      /* High cards reduce the count by one */
      return -1;
   } else {
      /* Anything else doesn't affect the count */
      return 0;
   }

}
/* Updates the card count based on the new card's value.

   Returns 1 if the card is low (2-6)
   Returns 0 if the card is somewhere in the middle (7-9)
   Returns -1 if the card is high (10-A)

   This behaves slightly different than the Head First C code, since it counts
   2s as low cards and aces as high cards. The original program didn't do this.
*/
Updates the card count based on the new card's value.
Returns 1 if the card is low (2-6)
Returns 0 if the card is somewhere in the middle (7-9)
Returns -1 if the card is high (10-A)

This behaves slightly different than the Head First C code, since it counts
2s as low cards and aces as high cards. The original program didn't do this.
Updates the card count based on the new card ' s value . Returns 1 if the card is low ( 2 - 6 ) Returns 0 if the card is somewhere in the middle ( 7 - 9 ) Returns - 1 if the card is high ( 10 - A ) This behaves slightly different than the Head First C code since it counts 2s as low cards and aces as high cards . The original program didn ' t do this .
int count_change(int val) {
   if ((val >= 2) && (val <= 6)) {
      return 1;
   } else if ((val == 10) || (val == 11)) {
      return -1;
   } else {
      return 0;
   }
}
int count_change ( int val ) { if ( ( val >= 2 ) && ( val <= 6 ) ) { return 1 ; } else if ( ( val == 10 ) || ( val == 11 ) ) { return -1 ; } else { return 0 ; } }
Updates the card count based on the new card's value.
Updates the card count based on the new card ' s value .
/* Low cards add one to the count */ /* High cards reduce the count by one */ /* Anything else doesn't affect the count */