do
{
system("cls");
do
{
cout << "Please enter a Whole number greater than 1: ";
cin >> whole;
cin.get();
if(whole < 1 || isalpha) // cannot be negative number not defined
cerr << "***Whole number cannot < 1!***" << endl;
}while(whole <1 || isalpha);
puts("Press the \"Enter\" key to continue");
cin.get(); // hold window open
return EXIT_SUCCESS;
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void primeFactor(long wholeNumber)
{
int i=2;
static int count = 0;
if(wholeNumber!=2)
{
do
{
if(wholeNumber%i==0) // if it is divisible it is not prime
{
cout << "(" << i << ")";
count++;
primeFactor(wholeNumber/i);
return;
}
i++;
}
while(i <= sqrt((long double)wholeNumber));
}
do
{
system("cls");
do
{
cout << "Please enter a Whole number greater than 1: ";
cin >> whole;
cin.get();
while(!cin)
{
cout << "***Whole number MUST be numeric!***"<<endl << "Please enter a Whole number greater than 1: ";
cin.clear();
cin.ignore(255,'\n');
cin >> whole;
cin.get();
}
if(whole < 1) // cannot be negative number not defined
cerr << "***Whole number cannot < 1!***" << endl;
}while(whole <1);