hi i am new to c++ i have problem to solve kindly help me

Start with any positive number n. If n is even divide it by 2, if n is odd multiply by 3 and add 1. Repeat until n becomes 1.For example sequence that starts at n = 10 is:

10, 5, 16, 8, 4, 2, 1

Write a function named lengthBumpy that returns the length of the bumpy sequence generated by its integer argument. The signature of the function is

int lengthBumpy(int n).suppose if n = 10 it return lenght of 7 (10, 5, 16, 8, 4, 2, 1)

help me please i canoot solve this problem i have spent 5 hours to do this but all in va in