Java实现抽奖游戏

代码如下:

import java.io.*;public class PresentDemo {/*** @param args main(String args[]){ ch;System.out.println(“按1/2/3数字键可得大奖!”);System.out.println(“按Q键可退出循环操作。”);try{while((ch=(char)System.in.read())!=’ ‘){System.in.skip(2);switch(ch){case ‘1’:System.out.println(“恭喜你得大奖,,一辆汽车!”);break;case ‘2’:System.out.println(“不错呀,你得到一台笔记本电脑!”);break;case ‘3’:System.out.println(“没有白来,你得到一台冰箱!”);break;case’q’:System.out.println(“欢迎下次再来!”);System.exit(0);default:System.out.println(“真不幸,你没有奖品!下次再来吧。”);}}}catch(Exception e){}}}思念是一种幸福的忧伤,是一种甜蜜的惆怅,是一种温馨的痛苦;

Java实现抽奖游戏

相关文章:

你感兴趣的文章:

标签云: