The examples, as you have shown them, are equivalent.
The difference shows up if you have more than two statements.
Code:
if (x == 0)
step_1();
step_2();
will always execute step_2() regardless of the value of x (indentation of the code doesn't change that) whereas
Code:
if (x == 0)
{
step_1();
step_2();
}
will not.
Also, be careful of
Code:
if (x = 0)
cout<< x << "is 0" <<endl;
as it does NOT test if x is zero. It assigns x to the value zero, and then does not produce any output. The equality test is == (two equal signs, not one).