easy java problem help
1
Name:
Anonymous
!8Z96F5duBs
2008-12-21 1:32
hey /prog/ im having a problem in java.
So im reading this text book, and it asks " Write a single line of code that uses the compound operator, -=, to subtract p-30 from the integer value v and store the result back in v. "
now im trying to use:
int v -= p-30;
but its not working in java, what could i be doing wrong?
2
Name:
Anonymous
2008-12-21 1:34
tripcode
trivial problem
no apostrophes
DON'T HELP HIM !
3
Name:
Anonymous
!8Z96F5duBs
2008-12-21 1:34
btw i just started a night ago, so dont shit your pants at my wrong answer
4
Name:
Anonymous
2008-12-21 1:34
v-=p-30 is v = v - p - 30
the compiler reads from left to right if the operators are on same precedence
try v-=(p-30)
5
Name:
Anonymous
2008-12-21 1:35
Maybe it works in Scheme.
6
Name:
Anonymous
!8Z96F5duBs
2008-12-21 1:39
>>4
yeah its still having errors
instead i went ahead and did:
int v, p;
v -= (p-30);
but its still having problems compiling it, even w\o parens
maybe im over thinking it, so im just wondering wtf
7
Name:
Anonymous
2008-12-21 1:44
OMG
8
Name:
Anonymous
2008-12-21 1:45
9
Name:
Anonymous
2008-12-21 1:45
the problem is v needs a value before you can modify it with a compound operator. You can't subtract from a NULL value.
10
Name:
Anonymous
2008-12-21 1:46
same with p too, give it a starting value.
11
Name:
Anonymous
2008-12-21 1:46
ah, i figured it out, i had to assign v and p values or else it wouldnt compile
im dumb T_T
12
Name:
Anonymous
2008-12-21 1:47
can you add to NULL?
13
Name:
Anonymous
2008-12-21 1:56
can you add to FAGGOT?
14
Name:
Anonymous
2008-12-21 1:58
your dumb
15
Name:
Anonymous
2008-12-21 2:10
>>13
can you add to MY DICK?
16
Name:
Anonymous
2008-12-21 2:39
his dumb
17
Name:
Anonymous
2008-12-21 3:22
you didn't define a value for v
try doing int v = 0;
and then, v -= p - 30
18
Name:
Anonymous
2008-12-21 3:44
(defn -= [v p](- v p 30))
19
Name:
Anonymous
2008-12-21 11:42
>>17
>>17
>>17
>>17
>>17
Now depart from this place
IMMEDIATELY
20
Name:
Anonymous
2008-12-21 21:19
>>15
I WOULD BUT I CAN'T FIND IT, PLEASE REMOVE IT FROM THAT FAGGOTS ASS!
21
Name:
Anonymous
2009-03-06 6:37
Control if you posted But even then you could write some nasty ass shit that uses the compound operator.
22
Name:
Trollbot9000
2009-07-01 7:57
Then the bastard beside.
23
Name:
Anonymous
2010-11-26 20:51