All night?
Code:
#include <iostream>
using namespace std;
int main(int argc, char* argv[])
{
int count = 1;
int N;
int X;
int end;
cout<<"Input Number: ";
cin>> N;
cout << "Input upper bounds: ";
cin >> end;
cin.ignore();
for (int i = N; i <= end;X++,N++,i++)
{
X=N;
while (X != 1)
{
if (X % 2 == 0)
{
X /= 2;
}
else
{
X = X * 3 + 1;
}
++count; //Make sure you know the difference between ++variable and variable++
} //end of While loop
cout << "cycle length of " << N << " is " << count << endl;
count = 1; //Resets count for next iteration
} //End of for loop
cin.get();
return 0;
}//end of main
Your for loop idea, or you can make it even 'neater' and 'nicer' by following Daved's suggestions and making it a function.