Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Black Jack
'Rextester.Program.Main is the entry point for your code. Don't change it. 'Compiler version 11.0.50709.17929 for Microsoft (R) .NET Framework 4.5 Imports System Imports System.Collections.Generic Imports System.Linq Imports System.Text.RegularExpressions Namespace Rextester Public Module Program 'Your code goes hereļ¼define record data type "Poker". Structure Poker Dim number As PokerNumber Dim suit As PokerSuits End Structure 'You need to define 2 enumerated data types too Enum PokerNumber Ace = 1 Two = 2 Three = 3 Four = 4 Five = 5 Six = 6 Seven = 7 Eight = 8 Nine = 9 Ten = 10 Jack = 11 Queen = 12 King = 13 End Enum Enum PokerSuits Diamond Club Heart Spade End Enum Public Function WriteCard(card as Poker) As String Dim result As String = "" select card.suit case 0 result = result + "Diamond " case 1 result = result + "Club " case 2 result = result + "Heart " case 3 result = result + "Spade " End Select select card.number case 2 to 10 result = result + (card.number).ToString case 11 result = result + "Jack " case 12 result = result + "Queen " case 13 result = result + "King " case 1 result = result + "Ace " End Select WriteCard = result End Function Public Sub Main(args() As string) 'Your code goes here 'generate 2 cards randomly and use the following statement for output: 'Console.WriteLine("Your card is " + WriteCard(card1)) Dim Card1 As Poker Dim Card2 As Poker Dim RandNum As New Random Card1.suit = RandNum.next(0,4) Card2.suit = RandNum.next(0,4) Card1.number = RandNum.next(1,13) Card2.number = RandNum.next(1,13) Console.WriteLine("Your first card is " + WriteCard(Card1)) Console.writeLine("Your second card is " + WriteCard(Card2)) 'Compare 2 cards and print the winner. If Card1.number > Card2.number Then Console.WriteLine("Card 1 won") Elseif Card1.number < Card2.number Then Console.WriteLine("Card 2 Won") Else If Card1.suit > Card2.suit Then Console.WriteLine("Card 1 won") Elseif Card1.suit < Card2.suit Then Console.WriteLine("Card 2 won") Else Console.WriteLine("Tie game") End If End If End Sub End Module End Namespace
run
|
edit
|
history
|
help
0
Extract values from square brackets
CAI Visual Basic - Libreria Funciones
CAI - Visual Basic - Ej. Citas Reloaded
Project Euler 1
loop 2 (until)
5
Algorithm to create first letter of each word mnemonic
I know all the veebeez!
Hello
3.1