您的位置:首页 >> 编程开发 >> .NET >> C# >> 正文
C# RSS
 

C#随机数的应用[原创]

http://www.rdxx.com 02年03月10日 11:09 互联网 我要投稿

关键词: 随机数 , C# , 应用 , 随机
 

C#随机数的应用[原创]

自己动手用C#编写体育彩票

现在有很多彩票软件神乎其神,但归根到底都是随机数的使用。我们用6位随机数来演示在C#中使用随机数
从而自己制作自己的彩票软件:)
--------------------------------
代码如下
/* 这是一个简单的随机数使用
 *  2004年3月29日
*/
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;

namespace MyLotteryProject
{
 /// <summary>
 /// Summary description for Form1.
 /// </summary>
 public class MyLotteryForm : System.Windows.Forms.Form
 {
  /// <summary>
  /// Required designer variable.
  /// </summary>
  
  private System.Windows.Forms.TextBox textBox1;
  private System.Windows.Forms.TextBox textBox2;
  private System.Windows.Forms.TextBox textBox3;
  private System.Windows.Forms.TextBox textBox4;
  private System.Windows.Forms.TextBox textBox5;
  private System.Windows.Forms.TextBox textBox6;
  public static int n_draw=1;
  private System.Windows.Forms.Label label1;
  private System.Windows.Forms.Label label2;
  private System.Windows.Forms.Label labelDaytime;
  private System.Windows.Forms.Label label3;
  private System.Windows.Forms.Label label4;
  private System.Windows.Forms.Label label5;     
  public int[] lottonumbers = new int[50]; //够放6个随机数字吧
  public int[] result = new int[50];
  private System.Windows.Forms.Button pbSort;
  private System.Windows.Forms.Button pbEnd;
  private System.Windows.Forms.Button pbNextDraw;
  private System.Windows.Forms.Label labelSort;
  private System.Windows.Forms.PictureBox pictureBox1;
  private System.Windows.Forms.PictureBox pictureBox3;
  private System.Windows.Forms.PictureBox pictureBox4;
  private System.Windows.Forms.Label label6;
  
  private System.ComponentModel.Container components = null;

  public MyLotteryForm()
  {
   //
   // Required for Windows Form Designer support
   //
   InitializeComponent();  
   //
   // TODO: Add any constructor code after InitializeComponent call
   //
  }

  /// <summary>
  /// Clean up any resources being used.
  /// </summary>
  protected override void Dispose( bool disposing )
  {
   if( disposing )
   {
    if (components != null)
    {
     components.Dispose();
    }
   }
   base.Dispose( disposing );
  }

  #region Windows Form Designer generated code
  /// <summary>

9 7 3 1 2 3 4 5 6 7 8 4 8 :


 
 
标签: 随机数 , C# , 应用 , 随机 打印本文
 
 
  热点搜索
 
 
 



Valid XHTML 1.0 Transitional
Copyright ©2005 - 2008 Rdxx.Com,All Rights Reserved
收藏本页
收藏本站