This assignment will focus on the use of functions and the passing of parameters. You are to construct a C program that plays a simplified game of blackjack. The rules are as follows:
The blackjack program should be organized as follows:
The program should contain a function called playHand () which contains two parameters: dealerWin and ranout (both semi-boolean values). playHand () is to play a hand of blackjack and then set dealerwin to true (1) if the dealer wins and false (0) otherwise. The main () function should repeatedly call PlayHand() and keep track of the total number of wins in the game using two variables: dealerTotal and playerTotal. However, playHand() should set Fanout to true (1) if it ran out of cards. In this case the program should not count this hand, print the total number of wins for both the player and the dealer, and exit.
The program should also contain a function called getCard () which has one! Integer parameter, points.getCard() is used to get the next card from the input file and assign its value to points. It should read the next character (ie card) in the file and set points to the appropriate value from 1 to 11. Note that a 10 will be represented in the file as T).
Also note that before reading a card, get Card() should check whether EOF IS true, and if it is signal that there are no more cards in the file by assigning a value of zero to points. Each time playHand() calls get Card() it much check to see if points is 0, meaning the cards have run out.
You should also build a betting system into your program. Allow the player to make a bet at the start of each hand and print out the total wins and losses at the end of each hand. If the player has 21 on her first two cards, she has blackjack and wins double her bet.
All functions should output information explaining what is happening (e.g., getCard() should write out the card it reads and its score, playHand () should write out the running point values as each new card is obtained, etc.).
As usual, make sure the program is well structured and readable. Remember be careful thought put into its organization will pay off at debugging time.
Once again, you should not be using any global variables in your program. A global variable is a variable declared outside of main()