By keeping a variable's scope limited, you make the code easier to read (because you don't have to scroll so far to find a variable's declaration). It also removes a small class of errors such as accidentally using a variable where you shouldn't be able to (e.g. because you made a typo and intended to refer to some other variable). It will also declutter debugging since a debugger will only show you the variables in scope.
However, the variable is constructed when it is encountered and destructed when that scope is left. In your first example, CoolObject is created once, assigned to 5 times, then destroyed later. In your second example, CoolObject is created and destroyed 5 times - although whether that is significantly different from being assigned to 5 times depends on the object. (And in languages other than C/C++, assignment often has quite different semantics.)