package xianxi_1;
import java.util.Random;
import java.util.Scanner;
public class lianxi_2 {
/**
* @param args
*/
public static void main(String[] args) {
//demo1();
//demo4();
Scanner sc = new Scanner(System.in);
int guess = (int)(Math.random()*100)+1;
while(true){
int result = sc.nextInt();
if (result < guess) {
System.out.println("小了");
}else if (result > guess) {
System.out.println("大了");
}else {
System.out.println("中了");
break;
}
}
}
private static void demo4() {
//demo2();
cfx c = new cfx(2,3);
//c.setHigth(2);
//c.setWidth(3);
System.out.println(c.Zc());
System.out.println(c.Mj());
}
private static void demo2() {
int[][] arr = {{1,2,3,4},{5,6,7},{7,8,9}};
int sum = 0;
for (int i = 0; i < arr.length; i++) {
for (int j = 0; j < arr[i].length; j++) {
//System.out.print(arr[i][j]);
sum = sum + arr[i][j];
}
}
System.out.println(sum);
}
private static void demo1() {
int[] arr = {12,13,85,95};
System.out.print("[");
for (int i = 0; i < arr.length; i++) {
if (i <arr.length-1) {
System.out.print(arr[i] + ",");
}
if (i == arr.length - 1) {
System.out.println(arr[i] +"]");
}
}
}
}
class cfx{
private int width;
private int higth;
public cfx(){}
public cfx(int width,int higth){
this.width = width;
this.higth = higth;
}
public void setWidth(int width){
this.width = width;
}
public int getWidth(){
return width;
}
public void setHigth(int higth){
this.higth = higth;
}
public int getHigth(){
return higth;
}
public int Zc(){
return 2*(width+higth);
}
public int Mj(){
return higth*width;
}
}
|
|