diff --git a/blackjackfolder/cardsystem.c b/blackjackfolder/cardsystem.c index f195872..458101c 100644 --- a/blackjackfolder/cardsystem.c +++ b/blackjackfolder/cardsystem.c @@ -5,10 +5,12 @@ long long read_number() { long long number = 0; + int negative_flag = 0; char c = getchar(); while (!(c >= '0' && c <= '9')) { + if(c=='-') negative_flag = 1; c = getchar(); } @@ -22,6 +24,8 @@ long long read_number() { else if(c=='m' || c=='M') number *= 1000000; else if(c=='b' || c=='B') number *= 1000000000; + if(negative_flag) number *= -1; + return number; } @@ -231,4 +235,4 @@ int game(char name[], int deck[][4][14], int *played_cards, int double_down, int } } -} \ No newline at end of file +}