-
Notifications
You must be signed in to change notification settings - Fork 1
/
Nothing Like Blackjack
52 lines (47 loc) · 1.64 KB
/
Nothing Like Blackjack
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
47
48
49
50
51
52
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ProgrammingAssignment2
{
/// <summary>
/// Programming Assignment 2 solution
/// </summary>
class Program
{
/// <summary>
/// Deals 2 cards to 3 players and displays cards for players
/// </summary>
/// <param name="args">command-line arguments</param>
static void Main(string[] args)
{
// print welcome message
Console.Write("Welcome to the Nothing Like BlackJack");
Console.WriteLine();
// create and shuffle a deck
Deck deck = new Deck();
deck.Shuffle();
// deal 2 cards each to 3 players (deal properly, dealing
// the first card to each player before dealing the
// second card to each player)
Card P11 = deck.TakeTopCard();
Card P21 = deck.TakeTopCard();
Card P31 = deck.TakeTopCard();
Card P12 = deck.TakeTopCard();
Card P22 = deck.TakeTopCard();
Card P32 = deck.TakeTopCard();
// flip all the cards over
P12.FlipOver();
// print the cards for player 1
Console.Write(P11.Rank + P11.Suit);
Console.Write(P12.Rank + P12.Suit);
// print the cards for player 2
Console.Write(P21.Rank + P21.Suit);
Console.Write(P22.Rank + P22.Suit);
// print the cards for player 3
Console.Write(P31.Rank + P31.Suit);
Console.Write(P32.Rank + P32.Suit);
}
}
}