Originally Posted by
ericjoe
Hi. I have tried an arithmetic question, but I cannot get the same final answer with the computer output. Here is the code.
Code:
int p=1;
int r=25;
int g=2;
int t=3;
int k;
k= p++ + --r/g++ - ++t%g++;
Don't have code like this. Lay out the precedence you want followed, with parentheses, and break it up over multiple lines of code.
Think of someone wanting (perhaps you in 5 years) to extend or modify this code. Think of the difficulty of mapping out the precedence inherent in that line, and then multiply it by perhaps a hundred or a thousand lines of code.
Writing code like that is just kicking yourself in the butt.