I'm in a C++.NET class, and last took math 20 years ago.

I have a classmate that has shared with me the following code for a program designed to estimate e using

e = 1 +1/1!+1/2!+ ..

Please see their code, which works, but doesn't do what I want it to, sure I could just copy it, but I'm trying to learn by studying it.

Code:
int _tmain

float e,
float num,
float num1;

e = 1;
num = 1;
num1 = 1;

while (num < 20 )
          {
           num1 = num1 * num;
           e = e + (1 / ( 1 * num1 ) );
           num = num + 1;
          }

cout << "e =  " << e;

return 0;
Now what I want to be able to do is pretty much the same thing, except that I wanted instead of a constant in the while loop, I wanted the constant to be set by the user.

Here was my code which I used against theirs to check the accuracy, but it isn't working right:

Code:
int _tmain()
{

float ulim; //Upper limit of the computation to be input by user
float result; // The computation will return this value
float counter; // Counter for while loop



result = 1;
counter = 1;

cout << "Please enter the upper limit for this computation  ";
cin >>ulim

while (counter<ulim)

	{
	
	ulim = ulim*counter;
	result = result +( 1 / ( 1* ulim));
        counter = counter + 1;
	}

	cout << "Best estimate of e based upon input is:  " <<result;
	

	return 0;
}
Thank you in advance for taking the time to read this.

After working on 4 new programming problems (I've managed to work out 2 of these) over the past 6 days, for a total of about 54 hours and countin (last week I didn't even know what a factorial is, but hours on Google, have changed that), I have tried so many things and it now results in total confusion when I work with any code...I want to learn, I want to put the work and get something from this, but I admit defeat, I don't know what I'm doing wrong and I could really use some help.

I'm not sure if I am coming across correctly, but I hope someone can point out where I'm whrong and why, and assist me with what I need to do, I will learn so much better that way. Right now I am fighting discouragement after 54 hours and I feel stupid...