Modified program to use a while loop to keep a running count of cards