我们的老龚天天秀他的点名器,今天讲了个随机1-100数,想到可以做点名器,试了一下,果然成功了.代码如下://java点名器
class CallName {
public static void main(String[] args) {
String[] s ={"邓能维","江可","刘奎","赵嘉荣","陆慧","聂冲","宋文超","何跃","周庆",
"张晨","黎显兆","张军","周迪","鞠永强","曾丰","曾华","陈泉元","邓凯宾",
"黄贵良","刘泽浩","杨明灿","张伟强","钟沅锋","田明","徐东阳","董方杰",
"阮伟科","林金兴","刘学勇","梁琦伟","刘智勇","李华","林伟文","陈星",
"苏永亮","杨乐","徐斌","宋瑶","王楚贵","郭喜平","文新星","郑舒欣","曹德华",
"陈家文","张灿耿","程林","范秋宁","范宇健","李贤智","陈沛明","李杰","唐昭亮",
"官左","陈舒挺","陈海乾","翁泽钿","于欣智","贾泽宇","王佳","黄鹏飞","林兴才",
"林兴煌","陈小林","谢灿","廖秋林","张宁","刘鹏","苏培源","宁文强","邓立","叶发伟",
"龙水文","陈灿","彭倩","徐彤","许涛","潘丽","龚奎","唐耀玮","袁峰","陈杰","罗志辉"};
while(true) {
int number = (int)(Math.random()*100);
if (number>82)
System.out.println("不是吧,这么被,再来一次吧");
}else {
System.out.println(s[number]);
break;
}
}
班上本有86人,但是少输了几个名字,数了一下有82人,索引为81.测试过,没有问题.
|
|