Exercises 1.4Fill in the blanks in each of the following statements: a) The logical unit that receives information from outside thecomputer for use by thecomputer is theinput unit. b) The process of instructing the computer to solve a probl
实验任务 实现幸运抽奖 Java代码 实验分析 使用if条件语句输出相应的结果package javatest;import java.util.Scanner;/*实验任务实现幸运抽奖实验分析使用if条件语句输出相应的结果*/public class Test4 {
public static void main(String[] args) {
Scanner in=new Scanner(System.in);
double winning=Math.random()*10;
int winprize=(int)winning;
System.out.println("兑奖码为"+winprize);
System.out.println("请输入你的兑奖码:");
int yournum=in.nextInt();
int num=yournum/100%10;
System.out.println("百位数为:"+num);
if(num==winprize){
System.out.println("恭喜你,中大奖了");
}else{
System.out.println("谢谢你的参与!此次的中奖码是现在java和C++都涉及的不是很深入,可能工作没有时间的缘故,还有自己比较懒,但是这些又必须要学习,好吧,那就从今天,从现在开始学习吧,一边学习,一边写博客,一边写总结,一边写感想。
1、面向对象
2、类和对象
3、实现方案的隐藏 类的创:"+winprize);
}
in.close();
}}/* *运算结果:
兑奖码为3请输入你的兑奖码:45667百位数为:6谢谢你的参与!此次的中奖码是:3*/
$(function () {
$('pre.prettyprint code').each(function () {
var lines = $(this).text().split('\n').length;
var $numbering = $('
$(this).addClass('has-numbering').parent().append($numbering);
for (i = 1; i <= lines; i++) {
$numbering.append($('
').text(i));};
$numbering.fadeIn(1700);
});
});