Note that there are some explanatory texts on larger screens.

plurals
  1. POHow do you use a switch case statement to convert Letters into numbers
    text
    copied!<p>I am making a black jack game and I need to use a switch case statement to convert A to 11, and T, Q, J, and K to 10, however I am not sure how to do the code. Would someone mind helping me with this problem?</p> <p>So far I have:</p> <pre><code>using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { Console.WriteLine("Welcome to Black Jack!\n"); Console.WriteLine("Pick two cards to add to your hand\n"); Console.WriteLine("Cards 2, 3, 4, 5, 6, 7, 8, 9 all are worth face value\n"); Console.WriteLine("Ace (A) is worth 11,Ten (T), Jack (J), Queen (Q), and King (K) are all worth 10 points\n"); Console.WriteLine("Whichever sum is higher, that player is declared the winner\n"); Console.WriteLine("What are player one's cards?"); Console.WriteLine("Enter card1 =?"); Console.WriteLine("Enter card2 =?"); double card1 = Double.Parse(Console.ReadLine()); double card2 = Double.Parse(Console.ReadLine()); Console.WriteLine("You entered: [" + card1, card2 + "]"); Console.WriteLine("What are player two's cards?"); Console.WriteLine("Enter card3 =?"); Console.WriteLine("Enter card4 =?"); double card3 = Double.Parse(Console.ReadLine()); double card4 = Double.Parse(Console.ReadLine()); Console.WriteLine("You entered: [" + card3, card4 + "]"); Console.ReadLine(); { Console.WriteLine("Calculate player 1: [" + "card1 + card2" + "]"); Console.WriteLine("Calculate player 2: [" + "card3 + card4" + "]"); { if (card1 + card2 &gt; card3 + card4) Console.WriteLine("Player One Wins!"); else if (card3 + card4 &gt; card1 + card2) Console.WriteLine("Player Two Wins!"); Console.ReadLine(); </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload