The question is:
"Create a program that asks the user to enter any integer, and then indicates to the user if the number entered was prime
or not. Do this by creating a C++
function whose input is any integer
; by counting the number of factors, your function should return
true if the input is prime, and false otherwise."
Here's my code (please give direction not a precise answer):
using namespace std;
int i;
bool isPrime (int x)
{
if (x%i == 0)
{
return true;
}
else
{
return false;
}
}
int main()
{
for (int i = 2; i < x; i++)
{
}
}
Thanks!