Results 1 to 4 of 4
Thread: Stuck with loops
- 05-15-2011, 07:11 PM #1
Member
- Join Date
- May 2011
- Posts
- 2
- Rep Power
- 0
-
You must have some type of collection of numbers that have already been guessed, so why not loop through that collection checking to see if the current number is amongst the already guessed ones.
- 05-15-2011, 07:45 PM #3
Member
- Join Date
- May 2011
- Posts
- 2
- Rep Power
- 0
How do i do that?
i have done till here:
how do i add to this code?Java Code:// Player input int[] arrayPlayerGuess = new int[3]; for (int i = 0; i < arrayPlayerGuess.length; i++) { number = Keyboard.readInt("Enter Your Guess Number > "); // Points for (int a = 0; a < arrayRandomNumber.length; a++) { if (number == arrayRandomNumber[a]) { count = count + 1; } } // End of points // End of player input { // Validation while (number <= 0 || number > 50) { System.out.println("Please Only Enter Number 1 To 50."); number = Keyboard.readInt("Enter Your Guess Number > "); // End of validation } } }Last edited by Fubarable; 05-15-2011 at 08:50 PM. Reason: code tags added
- 05-15-2011, 08:49 PM #4
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,408
- Blog Entries
- 7
- Rep Power
- 17
When people rob a bank they get a penalty; when banks rob people they get a bonus.
Similar Threads
-
[Semi-Beginner] (nested loops) What's wrong with my code? (nested loops)
By Solarsonic in forum New To JavaReplies: 20Last Post: 03-22-2011, 04:02 AM -
I'm stuck help!!!
By nobody58 in forum Advanced JavaReplies: 2Last Post: 03-18-2010, 02:52 PM -
Stuck in sea
By programmer_007 in forum JDBCReplies: 1Last Post: 09-17-2009, 04:00 AM -
Im on my last lab!!!! And im stuck...:(
By clanboru15 in forum New To JavaReplies: 5Last Post: 03-13-2009, 01:44 AM -
Stuck in need of help!
By Zombie_Leg! in forum New To JavaReplies: 1Last Post: 09-23-2008, 02:22 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks