« first day (1096 days earlier)      last day (3836 days later) » 

1:16 AM
Hi guys
anyone got experience with graph adt's?
 
 
6 hours later…
wat
7:16 AM
is any one here good with java
pastebin.com/M2B7g1qB how do i fix this
 
2 messages moved from Lounge<C++>
 
 
3 hours later…
10:00 AM
@wat it would help if you stated what the problem is. Few are interested in going through 400 lines of code when they could read just the couple that are relevant
 
hi
 
hi
 
 
2 hours later…
12:27 PM
how do i write the pseudo ' For j = 1 to i ' in java guys?
 
1:04 PM
isn't that almost the same question you asked earlier?
 
 
2 hours later…
3:15 PM
@Eggy It's the same idea as before: for (int j=1; j <= i; j++) { ... }
I'd recommend picking up a Java book or looking at a basic Java syntax tutorial
many other programming languages use the same for syntax
First you declare and set a counter (you could call it the iterator) int j=1
Second you give it a Boolean expression (j <= i) to evaluate on each loop. If it's true, it will execute the code between the curly braces { ... }; If the condition is false, execution will "break" out of the loop
Third you give it something to execute at the end of each loop. Most of the time you're incrementing (or decrementing) the counter j++
This is assuming that i is greater than or equal to 1 to begin with. If you're going from 1 to i and i is < 1, then you'll need to decrement (j--)
OK
That was a good morning exercise :-)
Here's something you can use for any value of int i (negative or positive)
for (int j=1; i<1 ? j>=i : j<=i; j += (i<1 ? -1 : 1)) { ... }
For example, if i is equal to -10, that loop would produce the following sequence: [1,0,-1,-2,-3,-4,-5,-6,-7,-8,-9,-10]
 
4:04 PM
gawd, that's pretty obfuscated code
 
 
1 hour later…
5:32 PM
I'd use the term hideous.
;)
 
5:55 PM
Yea it looks pretty ugly. But it's just a basic for loop with "ternaries" to increment / decrement based on whether i is less than 1 or greater than. ;-)
I know I wouldn't want to stumble upon that little nugget :-)
(without some sort of explanation)
 
 
1 hour later…
7:09 PM
Almost 500,000 Java questions. :)
 
 
1 hour later…
8:16 PM
hi
please open the above link
I have a doubt in the link above
 
8:31 PM
No.... people won't just open links. Do you have a specific problem you'd like to ask about?
and do you have a SSCCE?
 
 
3 hours later…
11:26 PM
Zzzzzz
 

« first day (1096 days earlier)      last day (3836 days later) »