If I remember how globals work in c++ (the closest I use is namespace variables, globals should never need to be used), the first one should work fine once you fixed the compile errors. Why didn't you simply test it? Also, each function definition needs the return type, in this case, void before the function name. The second one works, but only by sheer chance of the way you did it. It would never work any other way.
This is the most basic of c++. Buy a book, or at least go through some tutorial sites. There are plenty of references to decent c++ resources around here and here.
edit: Wait, hold on, I'm drunk. You're doing something different, I think.
That's true, however References are far beyond Randi's skill currently, hence why I didn't mention it. Really Randi, find a tutorial site or book or something and learn c++ that way.
The first method would work, because the variables are declared globally. The second method will not work, because each time you pass the integer to a function, it's making a duplicate integer (since you aren't using pass-by-value).
Both examples are considered "shitty design." There is never a good reason (in C++) to have free-floating global-variables like the first example.