The following is a part of a hailstone cpp program.
I want to write an option to let users enter 2 numbers and the program evaluates the longest sequence the number has within the 2-number range and return the count.
I have been struggling it for hours :P but the program is not working I don't know why, may I ask whats wrong with it?

Thanks for any help in advance.

Code:
int longestHailstoneSequenceLength(int start, int end)
{
    int max = 0;
    int s= start;
    while (s!=1)
    {
        int count = 0;
        for (int s; s<(end+1); s++)
        {
            int i= count;
            for (i = 2; i<1000; i++)
            {
        if (s%2==0)
            {
                s=s/2;
            }else
            {
                s=(3*s)+1;
            }
            if (s==1) break;
            if (max<count)
            {
                max=count;
            }
            }
        }
    }
    return max;
}