You might want to read up on how to use functions in the C or C++ language Check out
Functions at www.cplusplus.com. Or better yet, go for the
Tutorial there.
It will take you a lot less time understanding the principles of C++ programming that way than trying to figure out the workings of the language by example alone. the difference will be about the same as the time an archeologist would take to decipher an unknown language as opposed to one using a dictionary!