the random number is always 41

Code://*last edited 5/27/2009 number guessing game By CJ*/ #include <iostream> #include <cstdlib> using namespace std; int main() { int a;//to declare a a random number a = rand(); int x;// used to compare to a cout<<"welcome to the number guessing game\n"; if ( a < 50 ) { //gives you details about what the number (a) is cout<<"the number is less than 50\n"; } if ( a > 50 ) { cout<<"the number is greater than fifty\n"; } if ( a == 50 ) { cout<<"the number is fifty\n"; } if ( a > 0 ) { cout<<"the number is greater than 0\n"; } while ( x != a ) { cout<<"What do you think the number is?\n";//gives x which is compared to a cin>> x; cin.ignore(); if ( x == a ) { cout<<"hey thats it!\n"; } if ( x > a ) { cout<<"your too high\n"; } if ( x < a ) { cout<<"your to low\n"; cout<< a <<endl; } } cin.get(); } //end of program