Updated the stair counting function to contain an iterative solution C++