Pretty simple. Because C++ doesn't really care about how the whitespace looks,
just that there is whitespace. Which means the following is valid.
int
main
()
{cout<<"i got stuff"<<;cout<<endl;return
0;
}
Some things want whitespace, some don't care. The most important thing about
formatting is really keeping it easy to read for everyone, and consistant. There
is no single "standard" way to format everything. So just pick your own.
BUT, here is one resource you can use that alot of other people use as well.
Google C++ Style