All right, I have an assignment for this introductory C++ class, and I'm sorry if this sounds silly, but I really don't know where to begin. We've just now gotten through the different kinds of loops and nested loops and that sort of thing, and my assignment is to write a program that finds the integer between 1 and 1000 with the most divisors that have no remainder. I asked my friend who does tech support for Microsoft (and thinks he knows everything) and went rambling on about storage arrays (or something...) and I really don't know what to do. I was looking for some kind of pattern to it, so that it wouldn't just be this huge loop with every single number 1 to 1000 in it.... but I could use some help or advice or something.

Thanks....

First figure out how to count how many divisors are evenly divisible for single number. Once you have that, the solution presents itself as a variation of finding the maximum value in a set:

``````int main()
{
int most = 1;
int val = 1;

for ( int i = 1; i <= 1000; i++ ) {
int current = n_evenly_divisible ( i );

if ( current > most ) {
most = current;
val = i;
}
}

cout<< val <<" has "<< most <<" divisors evenly divisible"<<endl;
}``````

>and went rambling on about storage arrays (or something...)
Tech support people always overcomplicate things.