package ch6;
import java.io.*;
public class ch6_26_3
{
public static void main(String awgs[])throws IOException
{
InputStreamReader in=new InputStreamReader(System.in);
BufferedReader buf=new BufferedReader(in);
int g=0,a=0,b=100,c,d;
String hg;
int ca;
ca=(int)(Math.random()*100+1);
System.out.println("let's begin for 1~100");
do
{
hg=buf.readLine();
g=Integer.parseInt(hg);
if(g<ca)
a=g;
if(g>ca)
b=g;
if(ca!=g)
System.out.println("wrong!"+a+" to "+b);
}while(ca!=g);
System.out.println(g+" is answer");
}
}
========
let's begin for 1~100
50
wrong!50 to 100
75
wrong!50 to 75
60
wrong!60 to 75
68
wrong!68 to 75
72
wrong!72 to 75
74
wrong!72 to 74
73
73 is answer
留言列表