-
Notifications
You must be signed in to change notification settings - Fork 0
/
poker.c
46 lines (38 loc) · 821 Bytes
/
poker.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#include <stdio.h>
#include <stdlib.h>
#include "card.h"
#include "deck.h"
int main(int argc, char *argv[])
{
double dealt;
char* endptr1;
if(argc == 2)
{
dealt = strtod(argv[1], &endptr1);
}
else if(argc == 1)
{
dealt = 5;
}
printf("Welcome to the Poker Table\n");
struct deck *deck = make_deck();
shuffle_deck(deck);
if(!deck) {
fprintf(stderr, "Could not create deck");
return 1;
}
if(dealt > 52 || dealt < 0)
{
printf("%.2f was not a correct number of cards.\n", dealt);
dealt = 5;
printf("You were dealt %.2f cards.\n", dealt);
print_card_new(deck, dealt);
//print_card_abbrev(deck);
}
else if(dealt <= 52)
{
print_card_new(deck, dealt); //passes the variable 'deck' because it expects a pointer to a deck structure
//print_card_abbrev(deck);
}
free_deck(deck);
}