Refactor
:my
=>
'code'
Codes
Refactorings
Popular
Best
Submit
Spam
Account
Logout
Login
JavaScript doesn't seem to be activated, expect things to be ugly and sloppy!
Learn How to Create Your Own Programming Language
createyourproglang.com
Recent
FILE HOSTS PREMIUM ACCOUNT
ALL FILE HOST PREMIUM ACCOUNTS
Zynga Slingo Trainer v5.12
iTunes Gift Card Generator V3.1 2012
Diablo 3 GOLD Coins FREE
Working PS3 Jailbreak 3.65 And 3.66
ExtaBit Premium Accounts and Cookies
Steam Wallet Hack - Money Adder & Hack v3
Empires & Allies Hack Cheat Trainer v5.4.1
Eve Onnline 60 Days Time Card Generator v2
Popular
XBOX POINTS GENERATOR - MICROSOFT POINTS GENERATOR v1.2012
11 may 2012 premium uploading accounts 100% working
Free Microsoft Points
Free Microsoft Points - Microsoft Points Generator - Xbox Live Codes 2012
Car Town Free Blue Points Hack
Free CarTown Blue Points Generator and CarTown Templates
Better way to get content via jQuery $.get()
Free Microsoft Points
Simple Days Purger
Sharecash Downloader Bypass Surveys New 05/2012
Pastable version of
Guessing Game
<pre class='prettyprint' language='java'>import java.util.Scanner; import java.util.Random; public class GuessingGame { public static void main(String[] args) { int i = 0; int LB = 0, UB = 1000; boolean eql = false; Scanner in = new Scanner(System.in); Random r = new Random(); System.out.println("Think of a number between 0 and 1000"); int res = r.nextInt(UB); //first guess between 0 - 1000 System.out.println("Is it <, >, or = to " + res); i++; String input = in.nextLine(); //find if the the guess is higher, lower or equal to users number while (!eql == true) //need to keep guessing whilst the value guessed is wrong { if (input.equals ("<")) //if guess needs to be lower { UB = res; res = LB + (r.nextInt(UB - LB)); System.out.println("Is it <, >, or = to " + res); i++; input = in.nextLine(); } if (input.equals (">")) // if guess needs to be higher { LB = res; res = LB + (r.nextInt(UB - LB)); System.out.println("Is it <, >, or = to " + res); i++; input = in.nextLine(); } if (input.equals ("=")) //if guess is equal to, game is finished { System.out.println("It took me " + i + " guesses"); eql = true; } } } }</pre> <a href="http://www.refactormycode.com/codes/563-guessing-game" style="color:#fff" title="As seen on RefactorMyCode.com"><img alt="Small_logo" src="http://www.refactormycode.com/images/small_logo.gif" style="border:0" /></a>