Simple: What is the value of the variable test?
Answer: Whatever was in stack memory at the time of declaration.
int test;
for (int i=0; i < 3; i++)
{
test = test + i;
}
Local variables do not default to 0 in the C or C++ languages. They contain whatever was already in the location at the time of declaration. You have to initialize them to a know value before you use them, or you cannot predict the answer before hand.
Do you get the same answer every time you run the program?
If you do, then, if you have the time, try to find out why. Knowing this will improve your understanding and allow you to recognise bugs before they happen and fix them when you find them in the future.