You call the function three times (recursively or no), so the cout statement at the end is printed three times. It's really that simple. When you call the function recursively, the function that called it isn't ending. It's just waiting until the recursive call is finished, just like any other function call.