I need help to "always" display an array right aligned in only 5 columns no matter how big the array is and still have setw(5). I have it randomly generating 100 numbers right now to test. This is a project for class and I have been stuck. Thanks
You already have a loop which is counting (with i as the loop counter). You could make use of that, by using the % operator to find each multiple of 5. Or you could use a separate counter. But you don't need another loop. Put the code inside your existing loop. Just use an if statement to test when a newline is required.