怎么编写彩票模拟系统?
6+1彩票 前6位是从1到33之间取6个数,最后位是1到16之间的随机一位
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Threading;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
GetRandomArray(6,1,33);
Random a = new Random();
int number = a.Next(17);
//code = (char)(‘0’ + (char)(number % 4));
Label7.Text = Convert.ToString(number);
}
public int[] GetRandomArray(int Number, int minNum, int maxNum)
{
int j;
int[] b = new int[Number];
Random r = new Random();
for (j = 0; j < Number; j++)
{
int i = r.Next(minNum, maxNum + 1);
int num = 0;
for (int k = 0; k < j; k++)
{
if (b[k] == i)
{
num = num + 1;
}
}
if (num == 0)
{
b[j] = i;
}
else
{
j = j – 1;
}
}
Label1.Text = Convert.ToString(b[0]);
Label2.Text = Convert.ToString(b[1]);
Label3.Text = Convert.ToString(b[2]);
Label4.Text = Convert.ToString(b[3]);
Label5.Text = Convert.ToString(b[4]);
Label6.Text = Convert.ToString(b[5]);
return b;
}
用java编写一个彩票抽奖程序
我写给你,如果是本专业,以后要多多学习。JDK 1.6
import java.awt.GridLayout;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.util.Iterator;
import java.util.Random;
import java.util.Set;
import java.util.TreeSet;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JTextField;
public class LuckyDrawn {
private JFrame f = new JFrame(“Lucky Drawn”);
private JButton btn = new JButton(“Drawn”);
private JTextField result = new JTextField(“Result”);
private static final int MIN = 1;
private static final int MAX = 30;
private static final int RESULT_COUNT = 7;
public LuckyDrawn(){
f.add(btn);
f.add(result);
result.setEditable(false);
btn.addMouseListener(new MouseListener(){
public void mouseClicked(MouseEvent e) {
Random rand = new Random();
Set
while(set.size() < RESULT_COUNT){
set.add(new Integer(rand.nextInt(MAX)+ 1));
}
StringBuffer sb = new StringBuffer(“Lucky numbers are: “);
for (Iterator iter = set.iterator(); iter.hasNext();) {
sb.append(((Integer) iter.next()).intValue()).append(“, “);
}
result.setText(sb.substring(0, sb.length() – 2).toString());
f.pack();
}
public void mouseEntered(MouseEvent e) {}
public void mouseExited(MouseEvent e) {}
public void mousePressed(MouseEvent e) {}
public void mouseReleased(MouseEvent e) {}
});
f.setLayout(new GridLayout(2, 1));
f.setVisible(true);
f.setLocation(500, 200);
f.pack();
f.validate();
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
public static void main(String[] args) {
new LuckyDrawn();
}
}
怎么用VB编写彩票模拟系统
你学过vb吧!你可以用 rnd 函数生成随机整数就可以了..
我想用VB编一个彩票软件
Randomize ‘配置种子为系统时钟,以免没次程序开始后得到随机数都一样. RND 随机函数 Int((upperbound – lowerbound + 1) * Rnd + lowerbound)格式 (上限 -下限+1)*rnd+下限. 如果你是最大33,最小1,上限33,下限1 其实你那个哪里分明就是个随机选程序,和投注站的机选没什么差别.
彩票选号程序 C语言
循环里面 用 #include
谁能帮忙讲解一下,制作双色球的c语言程序啊?
就是随机数嘛,然后考虑的人性化一点(如果是c的话就多加点打印,延时什么的),说白了就是几个随机数.如果再简单就没意思了
关于彩票投注组合的C语言程序
#include
#include
void main()
{
int qian[15],hou[6];
int i,j,k,l,m,r,s;
int qian_n,hou_n;
FILE *fo;
if((fo=fopen(“d:\\LOTTO\\乐透组合.txt”,”r+”))==NULL)
{
printf(“Can’t open destination file!\n”);
exit(0);
}
printf(“请输入前区需要组合球的个数\n”);
scanf(“%d”,&qian_n);
printf(“请输入需前区要组合球的号码\n”);
for(i=0;i scanf(“%d”,&qian[i]); printf(“请输入后区需要组合球的个数\n”); scanf(“%d”,&hou_n); printf(“请输入需后区要组合球的号码\n”); for(i=0;i scanf(“%d”,&hou[i]); for(i=0;i for(j=i+1;j for(k=j+1;k for(l=k+1;l for(m=l+1;m for(r=0;r for(s=r+1;s fprintf(fo,”%d\t%d\t%d\t%d\t%d\t%d\t%d\n”,qian[i],qian[j],qian[k],qian[l],qian[m],hou[r],hou[s]); fclose(fo); } 这里只给出组合程序 你的问题我还没有完全理解 不能解决全部问题 public class Test { public static void main(String[] args) { int[] array = new int[5]; int count = 5; int tem = 0; for(int i=0; i<5; i++) { tem = (int) (Math.random() * 22 + 1); for(int j=0; jif(tem == array[j]) { tem = (int) (Math.random() * 22 + 1); j --; } } array[i] = tem; } } } #include #define N 10 main () { int k[5],t[N]; int i,j,sum; sum=0; printf("pease enter 5 zhong jiang nunber\n"); for (i=0;i 走势图需要一定软件开发基础,我这开发过多款走势图软件.没有软件基础可以考虑找人定做软件.大漠驼铃软件工作室,望采纳.JAVA编程,设计一个彩票号码生成器,主要处理5位数字序列的排列组合
C语言编程(彩票中奖)
如何开发一个彩票号码走势图软件