Ⅰ 求易語言隨機點名器的源碼,讀取文本內容,隨機抽取那種
源信或碼給你,敬坦輪自己亮信看
Ⅱ C#寫一個隨機點名系統
list
name = new list
(){"姓名1","姓名2","姓名3", ...};
//創建隨機數生成器
random ran = new random();
//明升生成范圍激陪老內的隨機數
int index = ran.next(0, name.count);
//輸出隨機獲取亂氏的姓名
messagebox.show(name[index]);滿意就採納,有疑問繼續追問!!
Ⅲ 用易語言製作一個隨機點名軟體,誰能把源碼發給我[email protected]
你好,這個非常簡單,用到超級列表框和編輯框就可以了。
我現在不在電腦,就用手機給你一個思路吧,首先導入姓名到超級列表裡,注意超級列表框要設置為普通報表類型
用個時鍾組件,按鈕被單擊時時鍾周期等於500也就是0.5秒,時鍾周期事件下寫代碼,首先聲明一個局部變數為次數,整數型
編輯框1.文本顏色=#黑色
編輯框1.內容=超級列表框1.取標題(0,次數)
次數=次數+1
.如果(次數=超級列表框1.取表項數()-1)
次數=0
.否則
.如果結束
按鈕停止被單擊的時候,事件下寫代碼
時鍾1.時鍾周期=0
編輯框1.文本顏色=#紅色
騷年,採納吧!
Ⅳ java點名系統源代碼
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JTextField;
public class test {
static String[] arr;
static boolean flag=true;
static List<String> a;
static JTextField jtf;
public static void main(String[] args) {
// TODO Auto-generated method stub
JFrame frame=new JFrame();
frame.setLayout(new GridLayout(1,2));
JButton button = new JButton("抽獎");
jtf = new JTextField();
frame.add(jtf);
frame.add(button);
a = new ArrayList<String>();
arr = new String[]{"張三","李四","王五"};
button.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e) {
int i=0;
fond:
while(true){
String str = arr[(int)(Math.random()*arr.length)];
for(String b:a){
if(b.equals(str)){
if(i>=arr.length){
jtf.setText("沒有人了");
break fond;
}
continue fond;
}
i++;
}
a.add(str);
jtf.setText(str);
break;
}
}
});
frame.setSize(500, 500);
frame.setLocation(500, 500);
frame.setVisible(true);
}
}
Ⅳ 用C#隨機點名小程序源代碼
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO; namespace xxx{
class Program
{
static void Main(string[] args)
{ //讀取TXT文檔
FileStream fs1 = new FileStream(@"D:/2.txt", FileMode.Open);
StreamReader sr = new StreamReader(fs1);
string str1 = sr.ReadToEnd();
sr.Close(); fs1.Close(); //TXT文檔中每個姓名一行,之間請已回車分隔 string[] strQ = str1.Split('\n'); //隨機提取 Random rdn = new Random();
int index = rdn.Next(0, strQ.Length);
Console.WriteLine(strQ[index]);
//return strQ[index];
}
}
}
Ⅵ 急急急!!!求各位高手 幫忙做個powerbuilder 點名系統 (程序怎麼寫)
得用到2個實例變數
long il_stoprow= 1 //上一次停在哪一列得記錄一下,下次從這幾繼續哈
boolean ib_stop = false
應該是三個text吧比較合理吧,點名,停止 ,繼續
long li
if this.text = '停止' then
this.text = '繼續'
li = il_stoprow
do while true //停止的時候得找到沒有點過的
if li = dw_1.rowcount() + 1 then li = 1
if dw_1.getselectedrow(li - 1) = li then //判斷當前行已被點過
li ++
else
dw_1.selectrow(li,true)
exit //找到沒有被點過的推出循環
end if
if li = il_stoprow then //找遍了還沒有找到
messagebox('','所有學侍戚生均已被點友談缺名')
exit
end if
loop
ib_stop = true
return
end if
if this.text = '點名' or this.text = '繼續好辯' then
this.text = '停止'
ib_stop = false
do while not ib_stop
if il_stoprow = dw_1.rowcount() + 1 then il_stoprow = 1
dw_1.scrolltorow(il_stoprow) //滾動起來
il_stoprow ++
yield() //允許處理滑鼠單擊等其他消息
loop
end if