Count controlled loops and functions
Mar 4, 2014 at 6:48pm UTC
Im writing a program that reads numbers and either classifies them as prime or prints their prime divisor, for a class. Im trying to understand what is being asked of me for the function.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
void PrintPrimeDivisors(int target)
{
const int limit = target / 2;
int primeCandidate = FIRST_PRIME; // FIRST_PRIME = 2
// Complete the count controlled while loop in the next
// line.
while ( primeCandidate <= limit )
{
// Complete the if condition
if ( IsAPrimeDivisor ) // IsAPrimeDivisor is bool
{
// Complete the cout.
cout << << " " ;
}
// increment the loop counter.
} // end of for loop
cout << endl;
}
I dont know if this is enough to go off of but any ideas or tips would be helpful
Last edited on Mar 4, 2014 at 7:09pm UTC
Topic archived. No new replies allowed.