帮忙用C语言编写一个类此彩票3D生成的随机数的程序

帮忙用C语言编写一个类此彩票3D生成的随机数的程序,第1张

数字三『彩神通』(包含3D和P3玩法)免费版**软件(原名3D『彩神通』免费版 注已改名)数字三『彩神通』免费版是数字三『彩神通』专业版的简化版本。数字三『彩神通』免费版在 *** 作上与数字三『彩神通』专业版一样方便、灵活。数字三『彩神通』免费版采用自行设计的第三代数据处理引擎,是国内外少有的一款功能强大、运算速度极快、设计合理、使用方便的数字选三型**软件。

数字三『彩神通』免费版采用了XP的设计风格,图表画面显示更加流畅,其界面美观大方,色彩淡雅,视觉舒适,界面的设计更加合理、更加实用、更加方便。

建立两个Command1和2

Dim RedBalls, BullBalls

Private Sub Command1_Click()

'Label1Caption = ""

rarr = GetRndNotRepeat(0, UBound(RedBalls), 6)

barr = GetRndNotRepeat(0, UBound(BullBalls), 1)

For i = 1 To 6

t = Now

Do

DoEvents

Loop While DateDiff("s", t, Now) < 15

FillStyle = 0

FillColor = vbRed

Form1Circle (500 + i 500, 1000), 200, vbRed

CurrentX = 350 + i 500

CurrentY = 840

Print Format(RedBalls(rarr(i)), "00")

Next i

t = Now

Do

DoEvents

Loop While DateDiff("s", t, Now) < 2

i = 7

FillStyle = 0

FillColor = vbBlue

Form1Circle (500 + i 500, 1000), 200, vbBlue

CurrentX = 350 + i 500

CurrentY = 840

Print Format(BullBalls(barr(1)), "00")

End Sub

Private Sub Command2_Click()

End

End Sub

Private Sub Form_Load()

RedBalls = Array(2, 3, 4, 7, 8, 9, 12, 13, 14, 17, 18, 19, 22, 23, 24, 27, 28, 29, 32, 33)

BullBalls = Array(3, 4, 5, 9, 13, 14, 15)

'Label1Caption = ""

Command1Caption = "开始"

Command2Caption = "退出"

Form1FontSize = 15

Form1FontName = "Arial"

Form1ForeColor = &HFFFFFF

End Sub

Public Function GetRndNotRepeat(ByVal NumMin As Integer, ByVal NumMax As Integer, ByVal n As Integer)

Dim arr() As Integer

If n > NumMax - NumMin + 1 Then

ReDim arr(0)

arr(0) = 0

Else

ReDim arr(n)

Dim b() As Byte

Dim m As Integer

m = Int((NumMax - NumMin) / 8)

ReDim b(m)

Dim x As Integer, y As Integer

Dim z As Byte

Randomize

arr(0) = 1

For i = 1 To n

Do

x = Int(Rnd (NumMax - NumMin + 1)) + NumMin

y = x - NumMin

z = 2 ^ (y Mod 8)

y = y \ 8

Loop While b(y) And z

b(y) = b(y) Or z

arr(i) = x

Next i

End If

GetRndNotRepeat = arr

End Function

已经运行过。

将就看下吧

<!DOCTYPE html>

<html lang="en">

<head>

<meta charset="UTF-8">

<meta name="viewport" content="width=device-width, initial-scale=10">

<title>Document</title>

</head>

<body>

<button id="buySelef">买一张(自选)</button>

<button id="buyRandom">买一张(机选)</button>

<button id="result">买一张(开奖)</button>

<div id='resultList'>

<span>结果</span>

</div>

</body>

</html>

<script src=">

呵呵

这个蛮简单的呀给你个例子!

int temp,pnum[35],num[7]; //临时变量,临时数组

for(int i=0;i<35;i++) //共有36个数组元素

pnum[i]=i+1;

//选号//

for(i=0;i<7;i++)

{

srand( (unsigned)time( NULL ) );

temp=rand();

temp=temp%36+1; //得到一个1-36的数

while(pnum[temp]==0)//如果此元素以被选过则重选

{

srand( (unsigned)time( NULL ) );

temp=rand();

temp=temp%36+1;

}

num[i]=temp; //选定一个号码

pnum[temp]=0; //给该元素置0,表示已被选过

}

//排序//

for(int chance=1;chance<7;chance++)

{

int position=chance; //元素排序用到的游标

for(i=0;i<7;i++){

if(num[position]>num[i]) //如果后面的元素大于前面的,就交换位置

{

temp=num[position];

num[position]=num[i];

num[i]=temp;

}

}

}

我写给你,如果是本专业,以后要多多学习。JDK 16

import javaawtGridLayout;

import javaawteventMouseEvent;

import javaawteventMouseListener;

import javautilIterator;

import javautilRandom;

import javautilSet;

import javautilTreeSet;

import javaxswingJButton;

import javaxswingJFrame;

import javaxswingJTextField;

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(){

fadd(btn);

fadd(result);

resultsetEditable(false);

btnaddMouseListener(new MouseListener(){

public void mouseClicked(MouseEvent e) {

Random rand = new Random();

Set<Integer> set = new TreeSet<Integer>();

while(setsize() < RESULT_COUNT){

setadd(new Integer(randnextInt(MAX)+ 1));

}

StringBuffer sb = new StringBuffer("Lucky numbers are: ");

for (Iterator iter = setiterator(); iterhasNext();) {

sbappend(((Integer) iternext())intValue())append(", ");

}

resultsetText(sbsubstring(0, sblength() - 2)toString());

fpack();

}

public void mouseEntered(MouseEvent e) {}

public void mouseExited(MouseEvent e) {}

public void mousePressed(MouseEvent e) {}

public void mouseReleased(MouseEvent e) {}

});

fsetLayout(new GridLayout(2, 1));

fsetVisible(true);

fsetLocation(500, 200);

fpack();

fvalidate();

fsetDefaultCloseOperation(JFrameEXIT_ON_CLOSE);

}

public static void main(String[] args) {

new LuckyDrawn();

}

}

以上就是关于帮忙用C语言编写一个类此彩票3D生成的随机数的程序全部的内容,包括:帮忙用C语言编写一个类此彩票3D生成的随机数的程序、用VB编写双色球程序,要求是以指定数字为尾的数字中随机选择该怎么编写程序、使用JavaScript设计一个彩票摇奖程序等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/zz/9741315.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-01
下一篇 2023-05-01

发表评论

登录后才能评论

评论列表(0条)

保存