Entry level programming assignment

Hello, I need help on one of my assignment. I would appreciate if anybody out there can help me.

The assignment:

Is to enter 7 numbers from 1-50. But the 7 numbers must add to a total between 90-180. The point of the assignment is to find out how many numbers between 1-50 can add up between 90-150. But you cannot use the number twice. Please help, thanks..
looking at your problem 7 nested for loops might do the trick

in the inner-most loop check if all your counter variables add up to between 90 and 180(or did you say 150)

you would then have a vector of std::vector<int>

sort each std::vector<int>

do a few comparisons and weed out the ones where a number is used twice


this is all of the top of my head. It might not work and there is probably an easier way.
Last edited on
Topic archived. No new replies allowed.