Read the faq and the thread at the top called "Posting Code? Read this first"

Here is your code nicely formated with code tags and standardized. Note **int** main, and <iostream> not <iostream.h>.

Read the FAQ and you will see why. The faq is found at cprogramming.com

Code:

#include <iostream>
using namespace std;
//Factor(n,k) returns true if k is a factor of n and false otherwise
bool factor ( bool n, bool k )
{
if ( n % k == 0 )
return true;
else
return false;
}
//Prime(n) returns true if the number n is prime and false otherwise
//Count_factors(k,b,n) counts the number of factors of the number n from a to b inclusive
bool count_factors ( bool k, bool b, bool n )
{
if ( k > b )
return 0;
else if factor ( n, k )
return count_factors ( k + 1 , b, n ) + 1;
else
return count_factors ( k + 1, b, n);
}
bool prime ( bool n )
{
if ( count_factors ( 1, n, n ) == 2 )
return true;
else
return false;
}
int main()
{
cout << prime ( 10 );
cout << endl;
cout << prime ( 11 );
cout << endl;
return 0;
}

I didnt find the problem yet.. let me look and i'll get back to you.

[edit]

one thing i noticed

if ( count_factors ( 1, n, n ) == 2 )

that wont work..

count_factors will always return 0 when its done.