Prime divisors of a number in C++
<p>This is my first question on Stackoverflow, so please excuse me if I'm doing something wrong. :) Can you help me with this code? Thank you! :)</p>

<pre><code>#include &lt;iostream&gt;
using namespace std;
</code></pre>

<p>1)</p>

<pre><code>int divisor(int a) // function that checks the divisors of a number *)
{
int i=1; // counter
while(i&lt;=a) // while the counter is less than the number given
{
    int i;
    if(primes(i)) // here i get the error "primes was not declared in this scope
    {
        if(a%i==0) // if the remainder of the operation is 0, the number is a divisor
        {
            cout&lt;&lt;"The divisors of the number are: "&lt;&lt;i&lt;&lt;endl; // prints the divisors
            ++i; // counter is incremented
        }
    }
    else // else it is not, and the counter i is incremented
    {
        ++i;
    }
}
}
</code></pre>

<p>2)</p>

<pre><code>int primes(int number) // checks if a number is prime
{
int i; 
for(i=2;i&lt;number;i++) // for loop until the counter i is less than a number
{
    if(number%i==0) // if the remainder of the operation is 0, the number is not prime
    {
        break;
    }
    else //else the number is prime
                    cout&lt;&lt;number;
        break;
    }
}
}
</code></pre>

<p>3)</p>

<pre><code>int main()
{
int n,i;
cout&lt;&lt;"Give the number: ";
cin&gt;&gt;n;
for(i=2;i&lt;n;i++)
{
    divisor(n);
}

}
</code></pre>
