Too many "if" statements?

How about something like this :

How about something that at least compiles? C++ statements end with a ;.

But, yeah, that's the general idea. One for loop, in the function, instead of a dozen outside it.