I would have thought both code fragments were valid and equivalent to each other. The compiler is indifferent to whether the { is on a line by itself or not. Some people (myself included) think {s and }s should be on a line to themselves. It may be that your
IDE has been set up to move { and } to lines by themselves. Can’t remember that from dev-c++, which I haven’t used for a long time, but I liked it when I used it.
system("PAUSE"); is unnecessary in some locations, and you may have to remove it if you are running from the command line.
It does, however, matter whether the { is before or after bits of code. So if you have got the cout line on the wrong side of a {. or even lost the { altogether, you will introduce an error into the code.
And welcome to the Ranch