基本信息
源码名称:使用java语言编译彩票系统(入门级)
源码大小:1.97KB
文件格式:.zip
开发语言:Java
更新时间:2020-12-14
友情提示:(无需注册或充值,赞助后即可获取资源下载链接)
嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):813200300
本次赞助数额为: 4 元×
微信扫码支付:4 元
×
请留下您的邮箱,我们将在2小时内将文件发到您的邮箱
源码介绍
使用java语言编译彩票系统
{
public static void main(String[]args)
{
int playtimes = 0;
try
{
if (args.length == 1)
playtimes = Integer.parseInt(args[0]);
else playtimes = 1;
}catch(NumberFormatException e)
{
System.out.println(e);
}
while(playtimes>0)
{
int choice = init();
switch(choice)
{
case 1:
int[] numbers_1 = new int[5];
input_1(numbers_1);
check_1(numbers_1);
break;
case 2:
int[] numbers_2 = new int[7];
input_2(numbers_2);
check_2(numbers_2);
}
playtimes--;
}
}
static int init()
{
boolean InputLoopflag = true;
int n = 0;
System.out.println("请按数字键1或2选择一种玩法(其中1代表\"21选5\",2代表\"6 1:\"):");
InputStreamReader ir;
BufferedReader in;
String s = new String();
try
{
ir = new InputStreamReader(System.in);
in= new BufferedReader(ir);
while(InputLoopflag)
{
s=in.readLine();
try
{
n =Integer.parseInt(s);
if(n!=1&&n!=2)
{
System.out.println("输入错误!请重试:");
continue;
}
InputLoopflag = false;
}catch(NumberFormatException e)
{
System.out.println("非数字!请重试:");
continue;
}
}
}catch(IOException e) { System.out.println(e);}
return n;
}
使用java语言编译彩票系统
彩票系统 两种玩法:21选5,6 1
public class Lottery
{
public static void main(String[]args)
{
int playtimes = 0;
try
{
if (args.length == 1)
playtimes = Integer.parseInt(args[0]);
else playtimes = 1;
}catch(NumberFormatException e)
{
System.out.println(e);
}
while(playtimes>0)
{
int choice = init();
switch(choice)
{
case 1:
int[] numbers_1 = new int[5];
input_1(numbers_1);
check_1(numbers_1);
break;
case 2:
int[] numbers_2 = new int[7];
input_2(numbers_2);
check_2(numbers_2);
}
playtimes--;
}
}
static int init()
{
boolean InputLoopflag = true;
int n = 0;
System.out.println("请按数字键1或2选择一种玩法(其中1代表\"21选5\",2代表\"6 1:\"):");
InputStreamReader ir;
BufferedReader in;
String s = new String();
try
{
ir = new InputStreamReader(System.in);
in= new BufferedReader(ir);
while(InputLoopflag)
{
s=in.readLine();
try
{
n =Integer.parseInt(s);
if(n!=1&&n!=2)
{
System.out.println("输入错误!请重试:");
continue;
}
InputLoopflag = false;
}catch(NumberFormatException e)
{
System.out.println("非数字!请重试:");
continue;
}
}
}catch(IOException e) { System.out.println(e);}
return n;
}