I'm used to programming in Java and not worrying about if I have to return anything |
OP, Java's functions are exactly the same in this respect. Either they return
void
(i.e., nothing) or they return a value (i.e., something). If you can, relate the concept of "function" which returns a value to the concept of a
function (i.e., a mapping) in mathematics.
To this end, the names of functions should not be participles or gerunds, but rather verbs or verb phrases. I mean "sort", not "sorting", "print", not "printing", and so on. If I had to guess, you're treating function names merely as labels for blocks of code, which is indicative of a conceptual error. Start by renaming them.
I'm extrapolating a bit here, but I guess you have got into the habit of avoiding returning values with the help of global state - that is, side-effects. This is not a scalable practice outside of tiny programs like this, and indeed the use of global state is strongly discouraged (in both Java and C++) for a number of good reasons.
At any rate, the first thing to do is understand what it means to return a value. Maybe give the tutorial a read:
http://www.cplusplus.com/doc/tutorial/functions/