I'm a little confused about the ++ and -- expressions...
this is one of my questions that i'm trying to understand...
What is printed by the following code?
double j = 3.14;
int k = 0;
while (k < j) {
cout << ++k << " ";
}
a. 0 1 2 3 b. 1 2 3 4
c. 0 1 2 3 4 d. 3.14
so if its ++k, i add the increment and then display it? so would it be
the first number be 1? and then i thought it would go up to 3 b/c it says while (k<j)
so basically i thought answer would be 1,2,3.. which isn't an option so is it A?
so even though 4 is greater than 3.14 (k>j), 4 is still included in the answer?