csharp Elegir una carta al azar solo con texto,Random Class
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了csharp Elegir una carta al azar solo con texto,Random Class相关的知识,希望对你有一定的参考价值。
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace VideoPoker
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
String[] palo = {"Picas","Corazones","Diamantes","Tréboles"};
String[] carta = {"as","dos","tres","cuatro","cinco","seis","siete","ocho","nueve","diez","jota","reina","rey"};
int iPalo = new Random().Next(4);
int iCarta = new Random().Next(13);
label1.Text = "La carta aleatoria es " + carta[iCarta] + " de " + palo[iPalo];
}
}
}
以上是关于csharp Elegir una carta al azar solo con texto,Random Class的主要内容,如果未能解决你的问题,请参考以下文章