Question: C++: what is i and j. IMPORTANT I know it's 3 and 3 but can someone please explain how we can get to that conclusion

C++: what is i and j. IMPORTANT I know it's 3 and 3 but can someone please explain how we can get to that conclusion by just reading the code, can it be explained to me because when i try to do it I get a different answer for i and j I got 1 and 4.

#include

using namespace std;

int main()

{

int i = 1;

int j = 0;

if (i++ == 1)

{

j = ++ i;

}

else

{

j+=4;

}

cout << i<< " and " << j <

return 0;

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!