#include <iostream>
usingnamespace std;
int main()
{
int number;
int option;
int helper = 0;
do
{
cout << "Cool Configurations: Primality and Factorization\n";
cout << "You can use this program in order to test a integer for primality and/or to find the factors of your chosen integer.\n";
cout << "Menu\n";
cout << "1) Choose option '1' if you would like to determine the primality of your number\n";
cout << "2) Choose option '2' if you would like to factor your number\n";
cout << "3) Choose option '3' if you would like to Exit this Program\n";
cout << "Please enter your chosen option from the above menu.\n";
cin >> option;
if (option == 1)
{
cout << "Please enter a positive integer.\n";
cin >> number;
cout << " Your number is " << number << ".\n";
if (number == 1)
{
cout << "One is not a prime number.\n";
}
elseif (number == 2)
{
cout << "Two is totally a prime number!\n";
}
elseif (number >= 3)
{
for (int p = 2; p*p <= number; p++)
{
if (number % p == 0)
{
helper = helper + 1;
}
}
if (helper == 0)
{
cout << "This is most definitely a prime number!!!\n";
}
else
{
cout << "This in unfortunately not a prime number!!!\n";
}
}
}
elseif (option == 2){
return 0;
}
}while(option!=3)
}