Hello. I am new to using c++ and I learn pretty fast. I am ahead of my class but this kind of stumps me. ^_^ I cannot get the smallest number to display the smallest number that the user entered. All it displays is 0. Is there any way to make it display the lowest number. Thanks in advanced.

(Oh and I don't want to use an array. ^_^)

Code:

#include<iostream.h>
main()
{
int num = 0;
int x = 0;
int sum = 0;
int largest = -65535;
int smallest = 65535;
float average;
int difference;
do
{
cout<<"Please enter an interger. (Enter 0 to exit):";
cin>>num;
sum = sum + num;
x++;
if(num > largest)
{
largest = num;
}
else
if(num < smallest)
{
smallest = num;
}
}
while(num != 0);
x = (x-1);
cout<<"You entered "<<x<<" numbers."<<endl;
average = sum / float(x);
cout<<"The average of the numbers you entered is "<<average<<endl;
cout<<"The largest number in the series is "<<largest<<endl;
cout<<"The smallest number in the series is "<<smallest<<endl;
difference = largest - smallest;
cout<<"The difference between the largest number and the smallest number is "<<difference<<endl;
return 0;
}