| zedidiah (12) | |||
I can't tell what this is doing. I need a for loop that sums up the product of several arrays. I am just going to post what I have and then explain.
right now "columns" is set to 3 CG[] is an array of 10 integers for "column groups" for now they are set to: CG[0] = 0 CG[1] = 3 CG[2] = 4 CG[3] = 3 NRN[] is an array of floating points NRN uses CG to map its indexes out 0 3 7 1 4 8 2 5 9 _6 FF[] is an array of random numbers basically constants I need the for loops to sum: NRN[0] = 0.5 NRN[1] = 0.75 NRN[2] = -1 NRN[3] = NRN[0]*FF[0] + NRN[1]*FF[1] + NRN[2]*FF[2] NRN[4] = NRN[0]*FF[3] + NRN[1]*FF[4] + NRN[2]*FF[5] NRN[5] = NRN[0]*FF[6] + NRN[1]*FF[7] + NRN[2]*FF[8] NRN[6] = -1 NRN[7] = NRN[3]*FF[9] + NRN[4]*FF[10] + NRN[5]*FF[11] + NRN[6]*FF[12] NRN[8] = NRN[3]*FF[13] + NRN[4]*FF[14] + NRN[5]*FF[16] + NRN[6]*FF[17] NRN[9] = -1 NRN, FF and CG are the only things in other code that I can't change in the loops when I debug it index goes to 3 and overflows its memory. which it shouldn't because columns = 3 so "index < (columns - 2)" should stop at 1 | |||
|
|
|||
| jaded7 (80) | |||
It is best if you divide your program into meaningful partitions. Additionally, try to use more descriptive, plain identifiers. | |||
|
|
|||
| greenleaf800073 (88) | |
|
do this: cout.width(3); //column witdh | |
|
|
|