C++ prime number program

I've been at this for a while and i can't find an answer, i need the program to display prime when a prime number is entered (while looping infinitely) and i haven't been able to do it.

here is the last part of the code after the data has been entered..

cout << primeFactor << " = ";

for( int i = 2; i <= primeFactor; i++ )
{
while( primeFactor % i == 0 )
{
primeFactor /= i;
cout << i;

if( primeFactor > 1 )
cout << " * ";
else
cout << endl << "Enter another number (0 to stop): ";
}
}
}
return 0;
}


Can anyone tell me what i'm missing?

Thanks!
Richard
I hate giving this answer, but please - search it here or in google.
It is such a basic thing, that is not even worth answering again.

http://www.cplusplus.com/search.do?q=prime+number
Topic archived. No new replies allowed.