hhhhhh,今天寫了一個抽幸運er的小程序,選擇困難症再也不用考慮上課提問哪一個同學了!(源代碼見最后)
源代碼:(只是用了一個簡單的Random函數抽號[沒有去重],下一步准備把學生名字放進去)
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace num
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
this.BackgroundImage = Image.FromFile("1.jpg");
this.Text = "幸運鵝";
this.Icon = new System.Drawing.Icon("2.ico");
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
Random rd = new Random();
label1.Text = rd.Next(1,40).ToString();
}
}
}