Given the line:
a += ++a + a++;
What is the correct translation of the given code line?
a) a = a + a;
a = a + 1;
a = a + a;
b) a = a + 1;
a = a + a + a;
a = a + 1;
c) a = a + 1 + 1;
a = a + a + a;
d) a = a;
a = a + 1;
a = a + 1;
a = a;
C++ programming?
a+= ++a + a++;
let b = ++a + a++
a+=b
a= b + A
++a and a ++ are both a+1
a= (a+1)+(a+1)+A
A is a incremented twice, therefore it equals itself + 2
a = (a + 1)+(a+1)+(a+2)
a=3a+4
b adds up to 3a+4 therefore the answer is b.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment