#include<stdioh>
void main()
{
int a[]={1,2,3,4,5,6,7};
int b[7],i,j,count=0,max=0,maxflag;
for(i=0;i<7;i++)
scanf("%d",&b[i]);
i=0;
while(i<7)
{
j=0;
count=0;
if(b[i]==a[j])
while(i<7 && j<7 && b[i]==a[j]) i++,j++,count++;
else
i++;
if(max<count) {max =count;maxflag=i;}
}
count = max;
if(count==7) printf("特等奖\n");
else if(count==6)
{
if(maxflag==7)
printf("二等奖\n");
else
printf("一等奖\n");
}
else if(count==5)
{
if(maxflag==7)
printf("三等奖\n");
else
printf("二等奖\n");
}
else if(count==4)
{
if(maxflag==7)
printf("四等奖\n");
else
printf("三等奖\n");
}
else if(count==3)
{
if(maxflag==7)
printf("五等奖\n");
else
printf("四等奖\n");
}
else if(count==2 && maxflag!=7)
printf("五等奖\n");
else
printf("没中奖\n");
}
void f()
{
int i1,i2,i3,i4,i5,i6,i7,i8;
for (i1=1;i1<32;i1++)
for (i2=1;i2<32;i2++){if (i1==i2) continue;
for (i3=1;i3<32;i3++){if (i1==i3) continue; if (i2==i3) continue;
for (i4=1;i4<32;i4++){if (i1==i4) continue; if (i2==i4) continue; if (i3==i4) continue;
for (i5=1;i5<32;i5++){if (i1==i5) continue; if (i2==i5) continue; if (i3==i5) continue; if (i4==i5) continue;
for (i6=1;i6<32;i6++){if (i1==i6) continue; if (i2==i6) continue; if (i3==i6) continue; if (i4==i6) continue; if (i5==i6) continue;
for (i7=1;i7<32;i7++){if (i1==i7) continue; if (i2==i7) continue; if (i3==i7) continue; if (i4==i7) continue; if (i5==i7) continue; if (i6==i7) continue;
for (i8=1;i8<32;i8++){if (i1==i8) continue; if (i2==i8) continue; if (i3==i8) continue; if (i4==i8) continue; if (i5==i8) continue; if (i6==i8) continue; if (i7==i8) continue;
printf("%d,%d,%d,%d,%d,%d,%d,%d\n",i1,i2,i3,i4,i5,i6,i7,i8);
}}}}}}}
}
不过估计没有什么用,因为输出的组合数多达
31302928272625/(12345678)个
没有实际意义。
Dim a(0 To 4) As Integer
Private Sub Command1_Click()
For i = 1 To 30
If i = 30 Then
t = t & i
Else
t = t & i & ","
End If
Next
For i = 0 To 4
j = Split(t, ",")
Randomize
temp = Int(Rnd (UBound(j) + 1) + 0)
Text1(i) = j(temp)
If temp <> UBound(j) Then
t = Replace(t, "," & j(temp) & ",", ",")
Else
t = Replace(t, "," & j(temp) & ",", "")
End If
Next
End Sub
Private Sub Command2_Click()
For i = 1 To 30
If i = 30 Then
t = t & i
Else
t = t & i & ","
End If
Next
For i = 0 To 4
j = Split(t, ",")
Randomize
temp = Int(Rnd (UBound(j) + 1) + 0)
a(i) = j(temp)
If temp <> UBound(j) Then
t = Replace(t, "," & j(temp) & ",", ",")
Else
t = Replace(t, "," & j(temp) & ",", "")
End If
Next
Print "中奖号码为:" & a(0) & vbTab & a(1) & vbTab & a(2) & vbTab & a(3) & vbTab & a(4)
For i = 0 To 4
For k = 0 To 4
If a(i) = Text1(k) Then n = n + 1
Next
Next
If n <> 0 Then
MsgBox "恭喜你中了" & 6 - n & "等奖"
Else
MsgBox "很遗憾,您没中奖"
End If
End Sub
我以22选5为例,``同道中人,人空交流一下,,,,
for i=1 to 22
for j=i to 22
for k =j to 22
for l=k to 22
for m=l to 22
s=i & k & j & l & m
if instr(s,2)=0 then
text1=text1 & s & vbcrlf
elseif instr(s,2)>0 then
if instr(s,3)=0 then text1=text1 & s & vbcrlf
if instr(s,7)=0 then text1=text1 & s & vbcrlf
if instr(s,20)=0 then text1=text1 & s & vbcrlf
end if
next m
next l
next k
next j
next i
我写给你,如果是本专业,以后要多多学习。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语言彩票兑奖程序全部的内容,包括:c语言彩票兑奖程序、如何用C语言编一个彩票32选8并显示所有排列组合的程序。、vb彩票摇奖 编写一个简易的30选五彩票摇奖程序。等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)