POST DELETED
Printable View
POST DELETED
HI,
I notice that there are two of you with the same assignment.
Code ://…Stuff System.out.println("Enter values for first set, ending with -1"); String firstSet = new String(); String secondSet = new String(); int setA = input.nextInt(); int setB = input.nextInt(); while (setA != -1) { setA = input.nextInt(); if (setA != -1) firstSet = firstSet + setA + " "; } //OTHER STUFF…
Think about the order that this is doing things.
What happens when you enter these values for the first set?
-1 -1 2 3 4 5 6 7 8 9
What happens when you enter these values for the first set?
1 -1 2 3 4 5 6 7 8 9
Can you see where the first two value are 'disappearing' now?
Also as a side note make sure you post in the correct section. I'm not sure how strict this forum is (my first time/post) but some forums can get pretty touchy about such things.
Suisse
What are these 2 lines for? Currently you read the first 2 numbers into these variables and then throw them away.Code java:int setA = input.nextInt(); int setB = input.nextInt();
I think i've been told you in the form of pseudocode on another thread in What's Wrong with my Code? Forum. Go and search there...