用C语言编写一道关于随机出现26个英文字母的程序

2025-04-23 12:07:26
推荐回答(1个)
回答1:

有段VB程序,仅供参考
Private
Sub
Command1_Click()
Dim
Num(8)
As
Byte
Dim
orgin
As
String
orgin
=
"12345678"
'原顺序放置好的数字
t
=
orgin
Randomize
Time
For
i
=
1
To
Len(t)

j
=
Int(Rnd
*
Len(t)
+
1)
‘随机生成一个位置值

Num(i)
=
Int(Mid(t,
j,
1))
'取出这个位置对应的
数字

t
=
Left(t,
j
-
1)
&
Right(t,
Len(t)
-
j)
'取出数字后的串
Next
Cls
Print
orgin
For
i
=
1
To
8
'输出随机生成的数值串

Print
Num(i);
Next
i
End
Sub