java小题:
//随机产生一个1-100之间的整数,
//每次猜完之后都要提示“大了”或者“小了”
import java.util.Scanner;public class GuessNumber {public static void main(String[] args) {Scanner input = new Scanner(System.in);int number = (int)(Math.random()*100);int guess;int count = 0;System.out.println("有一个0-99之间的数字,你猜一哈?");//用户猜测随机数do {guess = input.nextInt();if(number<guess) {System.out.println("大了!再来再来!");count++;}else if(number > guess) {System.out.println("小了!再来再来!");count++;}else {count++;break;}}while(true);System.out.println("这个数字是:"+number);System.out.println("您猜的次数是:"+count);//根据猜测次数评价if(count == 1) {System.out.println("你是真的C啊哥们儿!");}else if(count >= 2&&count<=5) {System.out.println("还是阔以的!");}else {System.out.println("啧~");}}}
欢迎各路神仙大佬来指教!