#include <cmath>
#include <iostream>
using namespace std;
void prime(int num)
{
int numPrime=true;
for(int c=2;c<num;c++)
{
if (num % c == 0)
{
numPrime=false;
break;
}
}
if (numPrime == true)
cout << "TRUE" << endl;
else
cout << "FALSE" << endl;
}
int main ()
{
int n;
int x = 1;
while ( x != 0 )
{
cout << "Enter a number or 0 to exit ";
cin >> n;
if ( n != 0 )
prime(n);
if (n == 0 )
break;
}
return 0;
}
Write a function that takes one integer as an argument and determines if the value is prime or not. If it is prime, return true. If not return false. Your main function should query the user for integers and use the function to determine if it is true or false and print the result to the screen. The program should continue to work until the user enters a query for zero. At that time, the program should let the user know both how many numbers where checked and the total number of prime numbers found.
I do not know how to add the checker at the end, please help!